| 
					
				 | 
			
			
				@@ -70,6 +70,8 @@ import com.fs.store.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.store.service.channel.PaymentHandler; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.store.service.channel.PaymentHandlerHolder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.store.service.channel.param.PayProcessContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.store.strategy.ShippingOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.store.strategy.ShippingTemplateManager; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.store.vo.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.system.service.ISysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.tzBank.TzBankService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -223,6 +225,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IFsShippingTemplatesService fsShippingTemplatesService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ShippingTemplateManager shippingTemplateManager; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IFsStoreProductAttrValueService fsStoreProductAttrValueService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 查询订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1196,7 +1203,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(param.getCouponUserId()!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             FsStoreCouponUser couponUser=couponUserService.selectFsStoreCouponUserById(param.getCouponUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(couponUser!=null&&couponUser.getStatus()==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(couponUser.getUseMinPrice().compareTo(storeProductPackage.getPayMoney())==-1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(couponUser.getUseMinPrice().compareTo(storeProductPackage.getPayMoney()) < 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     totalMoney=totalMoney.subtract(couponUser.getCouponPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1210,26 +1217,28 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 如果不包邮 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(ObjectUtil.equal(0,fsShippingTemplates.getAppoint())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 邮费等于商品总量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 商品总量 重量、件、体积 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BigDecimal totalSum = BigDecimal.ZERO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Integer type = fsShippingTemplates.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 获取当前套餐的商品列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ShippingOrder.ShippingOrderBuilder shippingOrderBuilder = ShippingOrder.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .cityId(address.getCityId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BigDecimal productSum = getProductSum(storeProductPackage, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 按件数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if(ObjectUtil.equal(ShippingTempEnum.TYPE_1,type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    shippingOrderBuilder.itemCount(productSum.intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 按重量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else if(ObjectUtil.equal(ShippingTempEnum.TYPE_2,type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    shippingOrderBuilder.weight(productSum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 按体积 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else if(ObjectUtil.equal(ShippingTempEnum.TYPE_3,type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    shippingOrderBuilder.volume(productSum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                ShippingTempEnum 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 计算体积 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BigDecimal bigDecimal = shippingTemplateManager 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .calculateShippingFee(fsShippingTemplates.getId(), shippingOrderBuilder.build()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(ObjectUtil.isNotNull(bigDecimal)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    postMoney = bigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1241,17 +1250,31 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .put("postMoney",postMoney); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private IFsStoreProductService fsStoreProductService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private List<FsStoreProduct> getProducts(FsStoreProductPackage storeProductPackage){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private BigDecimal getProductSum(FsStoreProductPackage storeProductPackage,Integer type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String products = storeProductPackage.getProducts(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         com.alibaba.fastjson.JSONArray objects = JSON.parseArray(products); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal sum = BigDecimal.ZERO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for(int i=0;i<objects.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             JSONObject jsonObject = objects.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Long id = jsonObject.getLong("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Long productId = jsonObject.getLong("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Long count = jsonObject.getLong("count"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 按件数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(ObjectUtil.equal(ShippingTempEnum.TYPE_1,type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sum = sum.add(BigDecimal.valueOf(count)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 按重量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if(ObjectUtil.equal(ShippingTempEnum.TYPE_2,type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<FsStoreProductAttrValue> fsStoreProductAttrValues 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        = fsStoreProductAttrValueService.selectFsStoreProductAttrValueByProductId(productId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sum = fsStoreProductAttrValues.stream().map(FsStoreProductAttrValue::getWeight).reduce(BigDecimal.ZERO, BigDecimal::add); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 按体积 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if(ObjectUtil.equal(ShippingTempEnum.TYPE_3,type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<FsStoreProductAttrValue> fsStoreProductAttrValues 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        = fsStoreProductAttrValueService.selectFsStoreProductAttrValueByProductId(productId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sum = fsStoreProductAttrValues.stream().map(FsStoreProductAttrValue::getVolume).reduce(BigDecimal.ZERO, BigDecimal::add); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return sum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 |