|
@@ -19,6 +19,8 @@ import org.springblade.modules.finance.service.IOrderGoodsService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import org.springblade.modules.mall.entity.GoodsInfo;
|
|
import org.springblade.modules.mall.entity.GoodsInfo;
|
|
import org.springblade.modules.mall.service.IGoodsInfoService;
|
|
import org.springblade.modules.mall.service.IGoodsInfoService;
|
|
|
|
+import org.springblade.modules.system.entity.User;
|
|
|
|
+import org.springblade.modules.system.service.IUserService;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -39,6 +41,7 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
private final IGoodsInfoService iGoodsInfoService;
|
|
private final IGoodsInfoService iGoodsInfoService;
|
|
private final IFacilityCargoWayService iFacilityCargoWayService;
|
|
private final IFacilityCargoWayService iFacilityCargoWayService;
|
|
private final IShopService iShopService;
|
|
private final IShopService iShopService;
|
|
|
|
+ private final IUserService iUserService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<OrderGoodsVO> selectOrderGoodsPage(IPage<OrderGoodsVO> page, OrderGoodsVO orderGoods) {
|
|
public IPage<OrderGoodsVO> selectOrderGoodsPage(IPage<OrderGoodsVO> page, OrderGoodsVO orderGoods) {
|
|
@@ -64,6 +67,7 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
Assert.notNull(cargoWay, "货道信息不存在");
|
|
Assert.notNull(cargoWay, "货道信息不存在");
|
|
Shop shop = iShopService.getById(request.getShopId());
|
|
Shop shop = iShopService.getById(request.getShopId());
|
|
Assert.notNull(shop, "门店信息不存在");
|
|
Assert.notNull(shop, "门店信息不存在");
|
|
|
|
+ User user = iUserService.getById(request.getUserId());
|
|
|
|
|
|
// 订单初始化
|
|
// 订单初始化
|
|
Order order = iOrderService.init();
|
|
Order order = iOrderService.init();
|
|
@@ -77,6 +81,8 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
BigDecimal payAmount = cargoWay.getSalePrice().multiply(BigDecimal.valueOf(cargoWay.getDiscount())).multiply(BigDecimal.valueOf(request.getGoodsNum()));
|
|
BigDecimal payAmount = cargoWay.getSalePrice().multiply(BigDecimal.valueOf(cargoWay.getDiscount())).multiply(BigDecimal.valueOf(request.getGoodsNum()));
|
|
order.setPaymentAmount(payAmount);
|
|
order.setPaymentAmount(payAmount);
|
|
order.setDiscountAmount(order.getTotalAmount().subtract(order.getPaymentAmount()));
|
|
order.setDiscountAmount(order.getTotalAmount().subtract(order.getPaymentAmount()));
|
|
|
|
+ order.setConsignee(user.getName());
|
|
|
|
+ order.setConsigneePhoneNumber(user.getPhone());
|
|
iOrderService.save(order);
|
|
iOrderService.save(order);
|
|
|
|
|
|
OrderGoods orderGoods = new OrderGoods();
|
|
OrderGoods orderGoods = new OrderGoods();
|