|
@@ -110,6 +110,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.*;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -2221,9 +2222,13 @@ public class OrderServiceImpl implements OrderService {
|
|
|
});
|
|
|
// 将在循环中查询数据库改为一次性查询
|
|
|
List<GoodsEntity> goodsEntityList = goodsService.queryGoodsStockByQueryGoodsVoList(queryGoodsVOList);
|
|
|
+ Map<String, GoodsEntity> goodsEntityMap = goodsEntityList.stream().collect(Collectors.toMap(GoodsEntity::getSku, Function.identity(), (k1, k2) -> k2));
|
|
|
// 复制集合数据
|
|
|
ListUtils listUtils = BeanUtils.instantiate(ListUtils.class);
|
|
|
listUtils.copyList(goodsEntityList, queryGoodsVOList);
|
|
|
+
|
|
|
+ // 商品总重量
|
|
|
+ BigDecimal weight = new BigDecimal(0);
|
|
|
// 检查库存和更新库存
|
|
|
for (QueryGoodsVO goodsDto : queryGoodsVOList) {
|
|
|
// 要购买的数量
|
|
@@ -2317,6 +2322,16 @@ public class OrderServiceImpl implements OrderService {
|
|
|
goodsEntity.setActivity(goodsDto.getActivity());
|
|
|
goodsEntity.setStoreId(storeId);
|
|
|
goodsEntity.setListPicUrl(goodsDto.getListPicUrl());
|
|
|
+ GoodsEntity goodsEntity1 = goodsEntityMap.get(sku);
|
|
|
+ if (Objects.nonNull(goodsEntity1)) {
|
|
|
+ goodsEntity.setNetWeight(goodsEntity1.getNetWeight());
|
|
|
+ goodsEntity.setWarehouseSn(goodsEntity1.getWarehouseSn());
|
|
|
+ goodsEntity.setConsignorSn(goodsEntity1.getConsignorSn());
|
|
|
+ goodsEntity.setWarehousSysGoodId(goodsEntity1.getWarehousSysGoodId());
|
|
|
+ goodsEntity.setInventoryType(goodsEntity1.getInventoryType());
|
|
|
+ goodsEntity.setDefectiveProductsGrade(goodsEntity1.getDefectiveProductsGrade());
|
|
|
+ weight = weight.add(goodsEntity1.getNetWeight().multiply(new BigDecimal(goodsEntity.getSellVolume())));
|
|
|
+ }
|
|
|
goodsEntities.add(goodsEntity);
|
|
|
} else {
|
|
|
// sku不存在
|
|
@@ -2391,6 +2406,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
order.setMerchOrderSn(merchOrderSn);
|
|
|
order.setCoupon_name(couponSn); // 借用这个字段来记录是否使用优惠券
|
|
|
order.setIdCard(userEntity.getIdNo());
|
|
|
+ order.setWeight(weight);
|
|
|
//插入订单信息和订单商品
|
|
|
orderDao.saveOrderVo(order);
|
|
|
|
|
@@ -2759,7 +2775,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
OrderInfoItemDTO orderInfoItemDTO = new OrderInfoItemDTO();
|
|
|
orderInfoItemDTO.setOrderId(orderGoodsVo.getOrderSn());
|
|
|
orderInfoItemDTO.setImageUrl(orderGoodsVo.getList_pic_url());
|
|
|
- orderInfoItemDTO.setBn("11111111");
|
|
|
+ orderInfoItemDTO.setBn(orderGoodsVo.getSku());
|
|
|
orderInfoItemDTO.setBarcode(orderGoodsVo.getBarcode());
|
|
|
orderInfoItemDTO.setName(orderGoodsVo.getGoods_name());
|
|
|
orderInfoItemDTO.setCost(orderGoodsVo.getMarket_price());
|
|
@@ -2786,7 +2802,12 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderInfoDTO.setConsigneeTel("0756-8800000");
|
|
|
orderInfoDTO.setConsigneeEmail("hk@greedc.com");
|
|
|
orderInfoDTO.setConsigneeMobile(order.getMobile());
|
|
|
- orderInfoDTO.setWeight("?");
|
|
|
+ BigDecimal weight = order.getWeight();
|
|
|
+ if (Objects.nonNull(weight)) {
|
|
|
+ orderInfoDTO.setWeight(weight.toString());
|
|
|
+ } else {
|
|
|
+ orderInfoDTO.setWeight("0");
|
|
|
+ }
|
|
|
orderInfoDTO.setQuantity(order.getNumber());
|
|
|
orderInfoDTO.setOrderTotal(order.getActual_price());
|
|
|
orderInfoDTO.setPlatform("store");
|
|
@@ -4845,6 +4866,12 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderGoodsVo.setGoodsRate(goodsDto.getGoodsRate());
|
|
|
orderGoodsVo.setSku(goodsDto.getSku());
|
|
|
|
|
|
+ orderGoodsVo.setNetWeight(goodsDto.getNetWeight());
|
|
|
+ orderGoodsVo.setWarehouseSn(goodsDto.getWarehouseSn());
|
|
|
+ orderGoodsVo.setConsignorSn(goodsDto.getConsignorSn());
|
|
|
+ orderGoodsVo.setWarehouseSysGoodId(goodsDto.getWarehousSysGoodId());
|
|
|
+ orderGoodsVo.setInventoryType(goodsDto.getInventoryType());
|
|
|
+ orderGoodsVo.setDefectiveProductsGrade(goodsDto.getDefectiveProductsGrade());
|
|
|
|
|
|
BigDecimal number = new BigDecimal(Long.valueOf(goodsDto.getSellVolume()));
|
|
|
BigDecimal goodsTotal = goodsDto.getRetailPrice().multiply(number);//单商品总价
|