Browse Source

门店供应链物品管理/记录

zhangkaikai 1 year ago
parent
commit
83cad64a70

+ 1 - 1
mp-service/src/main/java/com/qs/mp/channel/service/impl/ChannelCouponVerifyLogServiceImpl.java

@@ -107,7 +107,7 @@ public class ChannelCouponVerifyLogServiceImpl extends ServiceImpl<ChannelCoupon
       List<ChannelGoods> channelGoodsList = channelGoodsService.list(queryWrapper);
       List<ChannelGoods> channelGoodsList = channelGoodsService.list(queryWrapper);
       if (CollectionUtils.isEmpty(channelGoodsList)) {
       if (CollectionUtils.isEmpty(channelGoodsList)) {
           LogUtil.error(logger, "门店下未进货绑定该优惠劵的商品,channelId:{0}, couponId:{1}", channelId, coupon.getCouponId());
           LogUtil.error(logger, "门店下未进货绑定该优惠劵的商品,channelId:{0}, couponId:{1}", channelId, coupon.getCouponId());
-        throw new ServiceException("门店下未进货绑定该优惠劵的商品");
+        throw new ServiceException("商品未进货或库存不足,请前往采购商品");
       }
       }
       ChannelGoods channelGoods = channelGoodsList.get(0);
       ChannelGoods channelGoods = channelGoodsList.get(0);
       if (channelGoods.getRemainQty() == 0) {
       if (channelGoods.getRemainQty() == 0) {

+ 1 - 1
mp-service/src/main/java/com/qs/mp/channel/service/impl/ChannelGoodsOrderServiceImpl.java

@@ -99,7 +99,6 @@ public class ChannelGoodsOrderServiceImpl extends ServiceImpl<ChannelGoodsOrderM
         channelGoodsOrder.setOrderAmt(orderSettleVO.getOrderAmt());
         channelGoodsOrder.setOrderAmt(orderSettleVO.getOrderAmt());
         channelGoodsOrder.setFreightAmt(orderSettleVO.getFreightAmt());
         channelGoodsOrder.setFreightAmt(orderSettleVO.getFreightAmt());
         channelGoodsOrder.setPayAmt(orderSettleVO.getPayAmt());
         channelGoodsOrder.setPayAmt(orderSettleVO.getPayAmt());
-        channelGoodsOrder.setPayType(PayTypeEnum.WXPAY.getValue());
         channelGoodsOrder.setStatus(ChannelGoodsOrderStatusEnum.NOT_PAY);
         channelGoodsOrder.setStatus(ChannelGoodsOrderStatusEnum.NOT_PAY);
         channelGoodsOrder.setMemo(memo);
         channelGoodsOrder.setMemo(memo);
         channelGoodsOrder.setReceiver(addr.getReceiver());
         channelGoodsOrder.setReceiver(addr.getReceiver());
@@ -204,6 +203,7 @@ public class ChannelGoodsOrderServiceImpl extends ServiceImpl<ChannelGoodsOrderM
                 new LambdaUpdateWrapper<ChannelGoodsOrder>().set(ChannelGoodsOrder::getStatus,
                 new LambdaUpdateWrapper<ChannelGoodsOrder>().set(ChannelGoodsOrder::getStatus,
                                 ChannelGoodsOrderStatusEnum.NOT_DELIVER)
                                 ChannelGoodsOrderStatusEnum.NOT_DELIVER)
                         .set(ChannelGoodsOrder::getPayTime, DateUtils.parseDate(payOrder.getCompleteDate()))
                         .set(ChannelGoodsOrder::getPayTime, DateUtils.parseDate(payOrder.getCompleteDate()))
+                        .set(ChannelGoodsOrder::getPayType,payOrder.getPayResource())
                         .eq(ChannelGoodsOrder::getOrderId, channelGoodsOrder.getOrderId())
                         .eq(ChannelGoodsOrder::getOrderId, channelGoodsOrder.getOrderId())
                         .eq(ChannelGoodsOrder::getStatus, ChannelGoodsOrderStatusEnum.NOT_PAY));
                         .eq(ChannelGoodsOrder::getStatus, ChannelGoodsOrderStatusEnum.NOT_PAY));
         if (!rst) {
         if (!rst) {

+ 9 - 3
mp-service/src/main/java/com/qs/mp/channel/service/impl/ChannelGoodsSettleOrderServiceImpl.java

@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.Assert;
 import org.springframework.util.Assert;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -68,7 +69,6 @@ public class ChannelGoodsSettleOrderServiceImpl extends ServiceImpl<ChannelGoods
         settleOrder.setChannelId(channelGoodsList.get(0).getChannelId());
         settleOrder.setChannelId(channelGoodsList.get(0).getChannelId());
         settleOrder.setOrderAmt(orderAmt);
         settleOrder.setOrderAmt(orderAmt);
         settleOrder.setSettleAmt(settleVO.getSettleAmt());
         settleOrder.setSettleAmt(settleVO.getSettleAmt());
-        settleOrder.setPayType("微信");
         settleOrder.setStatus(ChannelGoodsOrderSettleEnum.NOT_PAY);
         settleOrder.setStatus(ChannelGoodsOrderSettleEnum.NOT_PAY);
         settleOrderService.save(settleOrder);
         settleOrderService.save(settleOrder);
 
 
@@ -87,7 +87,11 @@ public class ChannelGoodsSettleOrderServiceImpl extends ServiceImpl<ChannelGoods
             settleOrderItemService.save(settleOrderItem);
             settleOrderItemService.save(settleOrderItem);
         }
         }
 
 
-        boolean update = channelGoodsService.update(new LambdaUpdateWrapper<ChannelGoods>().set(ChannelGoods::getStatus, ChannelGoodsSettleStatusTypeEnum.DOING).eq(ChannelGoods::getOrderId, settleVO.getOrderId()));
+        boolean update = channelGoodsService.update(
+                new LambdaUpdateWrapper<ChannelGoods>()
+                        .set(ChannelGoods::getStatus, ChannelGoodsSettleStatusTypeEnum.DOING)
+                        .set(ChannelGoods::getRemainQty, 0)
+                        .eq(ChannelGoods::getOrderId, settleVO.getOrderId()));
         Assert.isTrue(update, "更新门店采购商品信息失败:order_id =" + settleVO.getOrderId());
         Assert.isTrue(update, "更新门店采购商品信息失败:order_id =" + settleVO.getOrderId());
 
 
         return settleOrder.getOrderId();
         return settleOrder.getOrderId();
@@ -106,6 +110,7 @@ public class ChannelGoodsSettleOrderServiceImpl extends ServiceImpl<ChannelGoods
                 new LambdaUpdateWrapper<ChannelGoodsSettleOrder>().set(ChannelGoodsSettleOrder::getStatus,
                 new LambdaUpdateWrapper<ChannelGoodsSettleOrder>().set(ChannelGoodsSettleOrder::getStatus,
                                 ChannelGoodsOrderSettleEnum.FINISHED)
                                 ChannelGoodsOrderSettleEnum.FINISHED)
                         .set(ChannelGoodsSettleOrder::getPayTime, DateUtils.parseDate(payOrder.getCompleteDate()))
                         .set(ChannelGoodsSettleOrder::getPayTime, DateUtils.parseDate(payOrder.getCompleteDate()))
+                        .set(ChannelGoodsSettleOrder::getPayType,payOrder.getPayResource())
                         .eq(ChannelGoodsSettleOrder::getOrderId, settleOrder.getOrderId())
                         .eq(ChannelGoodsSettleOrder::getOrderId, settleOrder.getOrderId())
                         .eq(ChannelGoodsSettleOrder::getStatus, ChannelGoodsOrderSettleEnum.NOT_PAY));
                         .eq(ChannelGoodsSettleOrder::getStatus, ChannelGoodsOrderSettleEnum.NOT_PAY));
         if (!rst) {
         if (!rst) {
@@ -115,11 +120,12 @@ public class ChannelGoodsSettleOrderServiceImpl extends ServiceImpl<ChannelGoods
         }
         }
         List<ChannelGoodsSettleOrderItem> items = settleOrderItemService.list(new LambdaQueryWrapper<ChannelGoodsSettleOrderItem>().eq(ChannelGoodsSettleOrderItem::getOrderId, settleOrder.getOrderId()));
         List<ChannelGoodsSettleOrderItem> items = settleOrderItemService.list(new LambdaQueryWrapper<ChannelGoodsSettleOrderItem>().eq(ChannelGoodsSettleOrderItem::getOrderId, settleOrder.getOrderId()));
         int settleQty = items.stream().mapToInt(ChannelGoodsSettleOrderItem::getSettleQty).sum();
         int settleQty = items.stream().mapToInt(ChannelGoodsSettleOrderItem::getSettleQty).sum();
+        List<Long> channelGoodsIdList = items.stream().map(ChannelGoodsSettleOrderItem::getChannelGoodsId).collect(Collectors.toList());
         boolean updateRst = channelGoodsService.update(new LambdaUpdateWrapper<ChannelGoods>()
         boolean updateRst = channelGoodsService.update(new LambdaUpdateWrapper<ChannelGoods>()
                 .set(ChannelGoods::getStatus, ChannelGoodsSettleStatusTypeEnum.FINISHED)
                 .set(ChannelGoods::getStatus, ChannelGoodsSettleStatusTypeEnum.FINISHED)
                 .set(ChannelGoods::getSettleQty, settleQty)
                 .set(ChannelGoods::getSettleQty, settleQty)
                 .set(ChannelGoods::getSettleTime, DateUtils.parseDate(payOrder.getCompleteDate()))
                 .set(ChannelGoods::getSettleTime, DateUtils.parseDate(payOrder.getCompleteDate()))
-                .eq(ChannelGoods::getOrderId, settleOrder.getOrderId()));
+                .in(ChannelGoods::getOrderId, channelGoodsIdList));
 
 
         if (!updateRst) {
         if (!updateRst) {
             LogUtil.error(logger, "更新门店采购商品信息失败。orderId:{0}",
             LogUtil.error(logger, "更新门店采购商品信息失败。orderId:{0}",