1.店铺关闭,批量下架店铺商品问题。

2.解决实物/虚拟订单发货逻辑判断问题
This commit is contained in:
lifenlong 2021-06-30 10:26:32 +08:00
parent a60a535708
commit 46f216c191
5 changed files with 26 additions and 31 deletions

View File

@ -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<Goods> {
/**
* 下架所有商家商品
* 根据店铺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<String> getGoodsIdByStoreId(String storeId);
@Update("UPDATE li_goods SET comment_num = comment_num + #{commentNum} WHERE id = #{goodsId}")
void addGoodsCommentNum(Integer commentNum, String goodsId);

View File

@ -93,7 +93,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
@Override
public void underStoreGoods(String storeId) {
this.baseMapper.underStoreGoods(storeId);
//获取商品ID列表
List<String> list= this.baseMapper.getGoodsIdByStoreId(storeId);
//下架店铺下的商品
updateGoodsMarketAble(list,GoodsStatusEnum.DOWN,"店铺关闭");
}
@Override

View File

@ -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<String> 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<String> 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());

View File

@ -13,17 +13,8 @@ public enum OrderTypeEnum {
*/
NORMAL,
/**
* 赠品订单
*/
GIFT,
/**
* 虚拟订单
*/
VIRTUAL,
/**
* 拼团订单
*/
PINTUAN
VIRTUAL
}

View File

@ -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());