|
|
@@ -18,6 +18,7 @@ import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
@@ -56,6 +57,8 @@ import com.fs.live.vo.LiveOrderItemVo;
|
|
|
import com.fs.live.vo.LiveOrderListVo;
|
|
|
import com.fs.live.vo.LiveOrderVo;
|
|
|
import com.fs.store.cache.IFsExpressCacheService;
|
|
|
+import com.fs.store.cache.IFsStoreProductAttrValueCacheService;
|
|
|
+import com.fs.store.cache.impl.IFsStoreProductCacheServiceImpl;
|
|
|
import com.fs.store.domain.*;
|
|
|
import com.fs.store.dto.*;
|
|
|
import com.fs.store.enums.*;
|
|
|
@@ -175,6 +178,15 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
|
|
|
@Autowired
|
|
|
private LiveOrderPaymentErrorMapper liveOrderPaymentErrorMapper;
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductGroupService storeProductGroupService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductAttrValueCacheService fsStoreProductAttrValueCacheService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductCacheServiceImpl fsStoreProductCacheService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
@@ -1295,7 +1307,28 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
FsStoreCartDTO cartDTO= JSONUtil.toBean(orderItem.getJsonInfo(),FsStoreCartDTO.class);
|
|
|
//如果是组合码,查询出真实的商品数据 然后写入
|
|
|
if(StringUtils.isNotEmpty(cartDTO.getGroupBarCode())){
|
|
|
-
|
|
|
+ FsStoreProductGroup group=storeProductGroupService.selectFsStoreProductGroupByBarCode(cartDTO.getGroupBarCode().trim());
|
|
|
+ if(group!=null){
|
|
|
+ JSONArray jsonArray=JSONUtil.parseArray(group.getProducts());
|
|
|
+ List<StoreProductGroupDTO> productGroupDTOS=JSONUtil.toList(jsonArray, StoreProductGroupDTO.class);
|
|
|
+ if(productGroupDTOS!=null){
|
|
|
+ for(StoreProductGroupDTO dto:productGroupDTOS){
|
|
|
+ FsStoreProductAttrValue attrValue=fsStoreProductAttrValueCacheService.selectFsStoreProductAttrValueById(dto.getId());
|
|
|
+
|
|
|
+ ErpOrderItem item=new ErpOrderItem();
|
|
|
+ item.setItem_code(attrValue.getBarCode());
|
|
|
+ item.setPrice(attrValue.getPrice().toString());
|
|
|
+ item.setQty(dto.getCount()*cartDTO.getNum());
|
|
|
+ item.setRefund(0);
|
|
|
+ // 查询仓库代码
|
|
|
+ String warehouseCode = fsStoreProductCacheService.getWarehouseCodeByProductId(attrValue.getProductId());
|
|
|
+ if(StringUtils.isNotBlank(warehouseCode)){
|
|
|
+ item.setWarehouseCode(warehouseCode);
|
|
|
+ }
|
|
|
+ details.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else{
|
|
|
ErpOrderItem item=new ErpOrderItem();
|
|
|
@@ -2217,14 +2250,13 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
LiveOrderItemDTO dto=new LiveOrderItemDTO();
|
|
|
dto.setImage(fsStoreProduct.getImage());
|
|
|
dto.setSku(String.valueOf(fsStoreProduct.getStock()));
|
|
|
- if (StringUtils.isEmpty(fsStoreProduct.getBarCode())) {
|
|
|
- FsStoreProductAttrValue fsStoreProductAttrValue = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProduct.getProductId()).stream().filter(attrValue -> StringUtils.isNotEmpty(attrValue.getBarCode())).findFirst().orElse(null);
|
|
|
- if (fsStoreProductAttrValue != null) {
|
|
|
- dto.setBarCode(fsStoreProductAttrValue.getBarCode());
|
|
|
- }
|
|
|
- } else {
|
|
|
- dto.setBarCode(fsStoreProduct.getBarCode());
|
|
|
+
|
|
|
+ FsStoreProductAttrValue fsStoreProductAttrValue = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProduct.getProductId()).stream().filter(attrValue -> StringUtils.isNotEmpty(attrValue.getBarCode())).findFirst().orElse(null);
|
|
|
+ if (fsStoreProductAttrValue != null) {
|
|
|
+ dto.setBarCode(fsStoreProductAttrValue.getBarCode());
|
|
|
+ dto.setGroupBarCode(fsStoreProductAttrValue.getGroupBarCode());
|
|
|
}
|
|
|
+
|
|
|
dto.setPrice(fsStoreProduct.getPrice());
|
|
|
dto.setProductName(fsStoreProduct.getProductName());
|
|
|
dto.setNum(Long.valueOf(liveOrder.getTotalNum()));
|
|
|
@@ -2427,6 +2459,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
FsStoreProductAttrValue fsStoreProductAttrValue = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProduct.getProductId()).stream().filter(attrValue -> StringUtils.isNotEmpty(attrValue.getBarCode())).findFirst().orElse(null);
|
|
|
if (fsStoreProductAttrValue != null) {
|
|
|
dto.setBarCode(fsStoreProductAttrValue.getBarCode());
|
|
|
+ dto.setGroupBarCode(fsStoreProductAttrValue.getGroupBarCode());
|
|
|
}
|
|
|
} else {
|
|
|
dto.setBarCode(fsStoreProduct.getBarCode());
|