|
@@ -64,7 +64,7 @@ public class ChannelGoodsSettleOrderServiceImpl extends ServiceImpl<ChannelGoods
|
|
|
settleOrder.setSettleNum(channelGoodsList.stream().mapToInt(ChannelGoods::getSettleQty).sum());
|
|
|
Integer orderAmt = 0;
|
|
|
for (ChannelGoods channelGoods : channelGoodsList) {
|
|
|
- orderAmt += channelGoods.getPurchaseCost() * channelGoods.getSettleQty();
|
|
|
+ orderAmt += channelGoods.getPurchaseCost() * channelGoods.getRemainQty();
|
|
|
}
|
|
|
settleOrder.setChannelId(channelGoodsList.get(0).getChannelId());
|
|
|
settleOrder.setOrderAmt(orderAmt);
|
|
@@ -85,14 +85,15 @@ public class ChannelGoodsSettleOrderServiceImpl extends ServiceImpl<ChannelGoods
|
|
|
settleOrderItem.setRemainQty(channelGoods.getRemainQty());
|
|
|
settleOrderItem.setSettleQty(channelGoods.getRemainQty());
|
|
|
settleOrderItemService.save(settleOrderItem);
|
|
|
- }
|
|
|
|
|
|
- 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());
|
|
|
+ boolean update = channelGoodsService.update(
|
|
|
+ new LambdaUpdateWrapper<ChannelGoods>()
|
|
|
+ .set(ChannelGoods::getStatus, ChannelGoodsSettleStatusTypeEnum.DOING)
|
|
|
+ .set(ChannelGoods::getSettleQty,channelGoods.getRemainQty())
|
|
|
+ .set(ChannelGoods::getRemainQty, 0)
|
|
|
+ .eq(ChannelGoods::getId, channelGoods.getId()));
|
|
|
+ Assert.isTrue(update, "更新门店采购商品信息失败:order_id =" + settleVO.getOrderId());
|
|
|
+ }
|
|
|
|
|
|
return settleOrder.getOrderId();
|
|
|
}
|
|
@@ -119,11 +120,9 @@ public class ChannelGoodsSettleOrderServiceImpl extends ServiceImpl<ChannelGoods
|
|
|
throw new ServiceException("渠道采购商品订单结算支付成功时,更新订单状态失败");
|
|
|
}
|
|
|
List<ChannelGoodsSettleOrderItem> items = settleOrderItemService.list(new LambdaQueryWrapper<ChannelGoodsSettleOrderItem>().eq(ChannelGoodsSettleOrderItem::getOrderId, settleOrder.getOrderId()));
|
|
|
- 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>()
|
|
|
.set(ChannelGoods::getStatus, ChannelGoodsSettleStatusTypeEnum.FINISHED)
|
|
|
- .set(ChannelGoods::getSettleQty, settleQty)
|
|
|
.set(ChannelGoods::getSettleTime, DateUtils.parseDate(payOrder.getCompleteDate()))
|
|
|
.in(ChannelGoods::getId, channelGoodsIdList));
|
|
|
|