|  | @@ -13,8 +13,11 @@ import com.fs.erp.service.IErpOrderService;
 | 
	
		
			
				|  |  |  import com.fs.his.domain.*;
 | 
	
		
			
				|  |  |  import com.fs.his.service.*;
 | 
	
		
			
				|  |  |  import com.fs.his.utils.PhoneUtil;
 | 
	
		
			
				|  |  | +import io.jsonwebtoken.lang.Assert;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  | +import org.apache.http.util.Asserts;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.context.annotation.Primary;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -50,6 +53,9 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      HzOMSClient hzOMSClient;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Value("${erp.hzOmsErpShopCode}")
 | 
	
		
			
				|  |  | +    private String hzOmsErpShopCode = "8080";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public ErpOrderResponse addOrder(ErpOrder order) {
 | 
	
		
			
				|  |  |          try {
 | 
	
	
		
			
				|  | @@ -57,7 +63,14 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              JSONObject omsOpenPtorderCreate = hzOMSClient.send("oms_open_ptorder_create", hzOrder);
 | 
	
		
			
				|  |  |              ErpOrderResponse res = new ErpOrderResponse();
 | 
	
		
			
				|  |  | -            res.setCode(order.getPlatform_code());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if("200".equals(omsOpenPtorderCreate.getString("code"))){
 | 
	
		
			
				|  |  | +                res.setCode(order.getPlatform_code());
 | 
	
		
			
				|  |  | +                res.setSuccess(true);
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                String message = omsOpenPtorderCreate.getString("message");
 | 
	
		
			
				|  |  | +                throw new RuntimeException(String.format("推送ERP失败 原因:%s",message));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              return res;
 | 
	
		
			
				|  |  |          } catch (Exception ex) {
 | 
	
		
			
				|  |  |              ex.printStackTrace();
 | 
	
	
		
			
				|  | @@ -95,7 +108,7 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |          //平台店铺编码 todo 测试环境只能写死 110111 用于联调测试 fsStoreOrder.getStoreId()
 | 
	
		
			
				|  |  | -        jsonObject.put("cptshopcode", 110111);
 | 
	
		
			
				|  |  | +        jsonObject.put("cptshopcode", hzOmsErpShopCode);
 | 
	
		
			
				|  |  |          //平台订单号
 | 
	
		
			
				|  |  |          jsonObject.put("cptordercode", orderCode);
 | 
	
		
			
				|  |  |          //平台售后单号
 | 
	
	
		
			
				|  | @@ -176,7 +189,7 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
 | 
	
		
			
				|  |  |          //订单单号
 | 
	
		
			
				|  |  |          obj.put("cptordercode", fsOrder.getOrderCode());
 | 
	
		
			
				|  |  |          //平台店铺编码 todo 测试环境只能写死 110111 用于联调测试 fsOrder.getStoreId()
 | 
	
		
			
				|  |  | -        obj.put("cptshopcode", 8080);
 | 
	
		
			
				|  |  | +        obj.put("cptshopcode", hzOmsErpShopCode);
 | 
	
		
			
				|  |  |          //平台店铺名称
 | 
	
		
			
				|  |  |          obj.put("cptshopname", fsStore.getStoreName());
 | 
	
		
			
				|  |  |          Integer iorderstatus = null;
 | 
	
	
		
			
				|  | @@ -254,6 +267,7 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
 | 
	
		
			
				|  |  |          //实际送达时间  格式 yyyy-MM-dd hh:mm:ss 如:2025-01-01 00:11:22 f
 | 
	
		
			
				|  |  |  //        obj.put("dconfirmtime", "");
 | 
	
		
			
				|  |  |          List<FsStoreOrderItem> fsStoreOrderItems = fsStoreOrderItemService.selectFsStoreOrderItemListByOrderId(fsOrder.getOrderId());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          int totalOrderItemCount = fsStoreOrderItems.size();
 | 
	
		
			
				|  |  |          BigDecimal divide = fsOrder.getDiscountMoney().divide(BigDecimal.valueOf(totalOrderItemCount), 2, BigDecimal.ROUND_HALF_UP);
 | 
	
		
			
				|  |  |          JSONArray goodArr = new JSONArray();
 | 
	
	
		
			
				|  | @@ -271,10 +285,13 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
 | 
	
		
			
				|  |  |              goodItem.put("cptspeccode", fsStoreOrderItem.getProductAttrValueId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              FsStoreProduct fsStoreProduct = fsStoreProductService.selectFsStoreProductById(fsStoreOrderItem.getProductId());
 | 
	
		
			
				|  |  | +            Assert.notNull(fsStoreProduct,String.format("当前产品 %d 没有找到", fsStoreOrderItem.getProductId()));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              FsStoreProductAttrValue fsStoreProductAttrValue = new FsStoreProductAttrValue();
 | 
	
		
			
				|  |  |              //判断是否含有商品规格信息 有则查询商品规格信息 没有取商品的价格
 | 
	
		
			
				|  |  |              if (null != fsStoreOrderItem.getProductAttrValueId()) {
 | 
	
		
			
				|  |  |                  fsStoreProductAttrValue = fsStoreProductAttrValueService.selectFsStoreProductAttrValueById(fsStoreOrderItem.getProductAttrValueId());
 | 
	
		
			
				|  |  | +                Asserts.notNull(fsStoreProductAttrValue,String.format("商品 %d 属性 %d 没有找到",fsStoreOrderItem.getProductId(), fsStoreOrderItem.getProductAttrValueId()));
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                  fsStoreProductAttrValue.setPrice(fsStoreProduct.getPrice());
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -324,7 +341,7 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          JSONObject obj = new JSONObject();
 | 
	
		
			
				|  |  |          //平台店铺编码 todo 测试环境只能写死 110111 用于联调测试 fsStoreAfterSales.getStoreId()
 | 
	
		
			
				|  |  | -        obj.put("cptshopcode", 110111);
 | 
	
		
			
				|  |  | +        obj.put("cptshopcode", hzOmsErpShopCode);
 | 
	
		
			
				|  |  |          //平台订单号
 | 
	
		
			
				|  |  |          obj.put("cptordercode", orderCode);
 | 
	
		
			
				|  |  |          //平台售后单号
 |