| 
					
				 | 
			
			
				@@ -3,7 +3,9 @@ package com.yijia.integral.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yijia.integral.domain.IntegralRuleDetail; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yijia.integral.domain.IntegralShopPic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yijia.integral.mapper.IntegralRuleDetailMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yijia.integral.mapper.IntegralShopPicMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yijia.integral.mapper.IntegralRuleMapper; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -23,6 +25,8 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IntegralRuleMapper integralRuleMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IntegralRuleDetailMapper integralRuleDetailMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IntegralShopPicMapper integralShopPicMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 查询积分规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      *  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -32,11 +36,24 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public IntegralRule selectIntegralRuleById(Long id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //查询油品数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         IntegralRule integralRule =integralRuleMapper.selectIntegralRuleById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         IntegralRuleDetail  detail  = new  IntegralRuleDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         detail.setParentId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        detail.setOilType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<IntegralRuleDetail> list =  integralRuleDetailMapper.selectIntegralRuleDetailList(detail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         integralRule.setItemsDetail(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //查询非油品数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IntegralRuleDetail  itemdetail  = new  IntegralRuleDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        itemdetail.setParentId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        itemdetail.setOilType("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<IntegralRuleDetail> notOillist =  integralRuleDetailMapper.selectIntegralRuleDetailList(itemdetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        integralRule.setNotOilList(notOillist); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //查询图片信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IntegralShopPic shopPic =new IntegralShopPic(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        shopPic.setParentId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<IntegralShopPic> shopPicList = integralShopPicMapper.selectIntegralShopPicList(shopPic); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        integralRule.setImgFileList(shopPicList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return integralRule; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -69,9 +86,29 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<IntegralRuleDetail> list =integralRule.getItemsDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (IntegralRuleDetail detail : list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 detail.setParentId(integralRule.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                detail.setOilType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 i = integralRuleDetailMapper.insertIntegralRuleDetail(detail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(integralRule.getNotOilList()!=null &&  integralRule.getNotOilList().size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<IntegralRuleDetail> notOilList =integralRule.getNotOilList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (IntegralRuleDetail itemdetail : notOilList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(itemdetail.getSaleAmt()!=null && itemdetail.getIntegral()!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    itemdetail.setParentId(integralRule.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    itemdetail.setOilType("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    integralRuleDetailMapper.insertIntegralRuleDetail(itemdetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(integralRule.getImgFileList()!=null &&  integralRule.getImgFileList().size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<IntegralShopPic> imgFileList =integralRule.getImgFileList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (IntegralShopPic img : imgFileList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                img.setParentId(integralRule.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                img.setStationId(integralRule.getStationId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                img.setStationName(integralRule.getStationName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                integralShopPicMapper.insertIntegralShopPic(img); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -88,11 +125,37 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         IntegralRuleDetail ruleDetail = new IntegralRuleDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ruleDetail.setParentId(integralRule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         integralRuleDetailMapper.deleteIntegralRuleDetail(ruleDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //从新保存数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(integralRule.getItemsDetail()!=null &&  integralRule.getItemsDetail().size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<IntegralRuleDetail> list =integralRule.getItemsDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (IntegralRuleDetail detail : list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                detail.setParentId(integralRule.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 integralRuleDetailMapper.insertIntegralRuleDetail(detail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(detail.getSaleAmt()!=null && detail.getIntegral()!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    detail.setParentId(integralRule.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    detail.setOilType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    integralRuleDetailMapper.insertIntegralRuleDetail(detail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(integralRule.getNotOilList()!=null &&  integralRule.getNotOilList().size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<IntegralRuleDetail> notOilList =integralRule.getNotOilList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (IntegralRuleDetail itemdetail : notOilList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               if(itemdetail.getSaleAmt()!=null && itemdetail.getIntegral()!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                   itemdetail.setParentId(integralRule.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                   itemdetail.setOilType("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                   integralRuleDetailMapper.insertIntegralRuleDetail(itemdetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IntegralShopPic integralShopPic =new IntegralShopPic(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        integralShopPic.setParentId(integralRule.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        integralShopPicMapper.deleteIntegralShopPic(integralShopPic); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(integralRule.getImgFileList()!=null &&  integralRule.getImgFileList().size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<IntegralShopPic> imgFileList =integralRule.getImgFileList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (IntegralShopPic img : imgFileList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                img.setParentId(integralRule.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                img.setStationId(integralRule.getStationId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                img.setStationName(integralRule.getStationName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                integralShopPicMapper.insertIntegralShopPic(img); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return  integralRuleMapper.updateIntegralRule(integralRule); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -100,7 +163,7 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 批量删除积分规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     *  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * insertIntegralRule 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param ids 需要删除的积分规则ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 |