|
@@ -79,6 +79,7 @@ import com.fs.wx.miniapp.config.WxMaProperties;
|
|
|
import lombok.Synchronized;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.http.util.Asserts;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.aop.framework.AopContext;
|
|
@@ -1833,7 +1834,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
|
|
|
// 如果订单是套餐
|
|
|
if(ObjectUtil.equal(order.getIsPackage(),1)){
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(order.getPackageJson());
|
|
|
+ JSONObject jsonObject = JSON.parseObject(order.getPackageJson());
|
|
|
if(StringUtils.isBlank(order.getPackageJson())){
|
|
|
logger.error("套餐订单缺少套餐信息:{}", orderId);
|
|
|
return;
|
|
@@ -1869,6 +1870,25 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ // 如果不是套餐
|
|
|
+ else {
|
|
|
+ Asserts.notNull(order.getItemJson(),"当前订单没有商品!");
|
|
|
+ com.alibaba.fastjson.JSONArray objects = JSON.parseArray(order.getItemJson());
|
|
|
+ if(CollectionUtil.isEmpty(objects)){
|
|
|
+ logger.error("订单商品列表为空! 订单id:{}", orderId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = objects.getJSONObject(0);
|
|
|
+ Long productId = jsonObject.getLong("productId");
|
|
|
+ Asserts.notNull(productId,"产品id不存在!");
|
|
|
+ FsStoreProduct fsStoreProduct = productService.selectFsStoreProductById(productId);
|
|
|
+ String warehouseCode = fsStoreProduct.getWarehouseCode();
|
|
|
+ if(StringUtils.isBlank(warehouseCode)){
|
|
|
+ logger.error("当前订单 {} 的仓库id不存在!",order.getId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ erpOrder.setWarehouse_code(warehouseCode);
|
|
|
+ }
|
|
|
|
|
|
ErpOrderResponse response= erpOrderService.addOrder(erpOrder);
|
|
|
//写入日志
|