| 
					
				 | 
			
			
				@@ -5,6 +5,8 @@ import java.util.Iterator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yijia.common.core.domain.model.LoginUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yijia.common.utils.SecurityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yijia.common.annotation.DataScope; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -194,7 +196,7 @@ public class SysDeptServiceImpl implements ISysDeptService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dept.setIntegralPrintFlag("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dept.setIntegralFlag("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dept.setLabelFlag("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dept.setPrintDeviceType("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dept.setPrintDeviceType("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else if(dept.getJiBie()!=null && dept.getJiBie()==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dept.setCardRuleFlag("0"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -440,6 +442,113 @@ public class SysDeptServiceImpl implements ISysDeptService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return deptMapper.updateDept(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //查询所有的油站信息,不涉及到优惠卷,电子卡,积分的共享。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<String> selectDeptIdList(SysDept dept) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //根据当前的deptId获取当前组织机构的级别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysDept sysDept = deptMapper.selectDeptById(dept.getDeptId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //超级管理员级别查询所有的油站和集团 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(sysDept!=null && sysDept.getJiBie()!=null  && sysDept.getJiBie()==0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SysDept sysDept1 = new SysDept(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sysDept1.setDelFlag("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<SysDept> list2 = deptMapper.selectDeptList(sysDept1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(SysDept dpt2:list2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                list.add(dpt2.getDeptId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 集团级别,查询集团和集团下的所有的站点信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else if(sysDept!=null &&sysDept.getJiBie()!=null  && sysDept.getJiBie()==1 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SysDept sysDept2 =new SysDept(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sysDept2.setParentId(dept.getDeptId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<SysDept> list2 = deptMapper.selectDeptList(sysDept2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(SysDept dpt2:list2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                list.add(dpt2.getDeptId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 查询油站信息。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else if(sysDept!=null && sysDept.getJiBie()!=null  && sysDept.getJiBie()==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SysDept depts  = deptMapper.selectDeptById(sysDept.getParentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            list.add(depts.getDeptId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *  查询分配代理管理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<SysDept> selectSysAgentList(SysDept dept) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return deptMapper.selectSysAgentList(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<SysDept> selectDeptAgentList(SysDept sysDept) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return deptMapper.selectDeptAgentList(sysDept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<SysDept> searchDeptList(SysDept sysDept) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return deptMapper.searchDeptList(sysDept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 查询当前人的站点信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<String> levelDeptList(Long levelId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LoginUser currentUser = SecurityUtils.getLoginUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<SysDept> deptList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> stringList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(currentUser.getUser().getDept().getJiBie()!=null && currentUser.getUser().getDept().getJiBie() == 0 && currentUser.getUser().getAgentFlag()!=null&& currentUser.getUser().getAgentFlag().equals("0")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //顶级 查询处所有的 集团和油站id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(levelId!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                deptList =deptMapper.selectChildrenDeptById(levelId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                deptList =deptMapper.selectChildrenDeptById(currentUser.getUser().getDeptId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else if(currentUser.getUser().getDept().getJiBie()!=null && currentUser.getUser().getDept().getJiBie() == 0 && currentUser.getUser().getAgentFlag()!=null&& currentUser.getUser().getAgentFlag().equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SysDept dept =new SysDept(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(levelId!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dept.setUserId(levelId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                deptList = deptMapper.selectDeptAgentList(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dept.setUserId(currentUser.getUser().getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                deptList = deptMapper.selectDeptAgentList(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else if(currentUser.getUser().getDept().getJiBie()!=null && currentUser.getUser().getDept().getJiBie() == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //查询集团及站点 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(levelId!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                deptList =deptMapper.selectGroupAndDeptList(levelId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                deptList =deptMapper.selectGroupAndDeptList(currentUser.getUser().getDeptId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SysDept dept =new SysDept(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dept.setDeptId(currentUser.getUser().getDeptId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dept.setParentId(currentUser.getUser().getDept().getParentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            deptList.add(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(deptList!=null && deptList.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(SysDept sysDept:deptList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                stringList.add(sysDept.getDeptId()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return stringList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 查询代理所有的集团 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param sysDept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<SysDept> selectGroupAgentList(SysDept sysDept) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return deptMapper.selectGroupAgentList(sysDept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 递归列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 |