| 
					
				 | 
			
			
				@@ -3,14 +3,13 @@ package com.kmall.admin.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.google.common.collect.ImmutableBiMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.admin.entity.FreightEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kmall.admin.entity.FreightItemEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.admin.service.FreightService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.admin.utils.ParamUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.common.entity.SysUserEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.kmall.common.utils.PageUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.kmall.common.utils.Query; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.kmall.common.utils.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.kmall.common.utils.ShiroUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kmall.common.utils.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.shiro.authz.annotation.RequiresPermissions; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,6 +62,27 @@ public class FreightController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping("/save") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequiresPermissions("freight:save") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public R save(@RequestBody FreightEntity freight) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (freight.getFreightItemEntityList() == null || freight.getFreightItemEntityList().size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new RRException("配送区域及运费不能为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (FreightItemEntity freightItemEntity : freight.getFreightItemEntityList()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (freightItemEntity != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Map<String, Object> valideDate = MapBeanUtil.fromObject(freightItemEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.put("firstPiece", "首件"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.put("freight", "运费"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.put("continuePiece", "续件"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.put("renew", "续费"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                R r = ValidatorUtil.isEmpty(builder.build(), valideDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (Integer.valueOf(r.get("code").toString()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw new RRException(r.get("msg").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         freightService.save(freight); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return R.ok(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -74,6 +94,26 @@ public class FreightController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping("/update") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequiresPermissions("freight:update") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public R update(@RequestBody FreightEntity freight) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (freight.getFreightItemEntityList() == null || freight.getFreightItemEntityList().size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new RRException("配送区域及运费不能为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (FreightItemEntity freightItemEntity : freight.getFreightItemEntityList()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (freightItemEntity != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Map<String, Object> valideDate = MapBeanUtil.fromObject(freightItemEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.put("firstPiece", "首件"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.put("freight", "运费"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.put("continuePiece", "续件"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.put("renew", "续费"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                R r = ValidatorUtil.isEmpty(builder.build(), valideDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (Integer.valueOf(r.get("code").toString()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw new RRException(r.get("msg").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         freightService.update(freight); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return R.ok(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -84,7 +124,7 @@ public class FreightController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping("/delete") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequiresPermissions("freight:delete") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public R delete(@RequestBody Integer[]ids) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R delete(@RequestBody Integer[] ids) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         freightService.deleteBatch(ids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return R.ok(); 
			 |