| 
					
				 | 
			
			
				@@ -14,6 +14,7 @@ import com.fs.company.vo.CompanyVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.company.vo.DeptDataVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.mapper.FsCourseRedPacketLogMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.his.vo.OptionsVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.store.config.CompanyMenuConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.store.config.StoreConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.store.domain.FsStoreOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.store.domain.FsStorePayment; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,7 +23,6 @@ import com.fs.system.service.ISysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections4.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.beans.BeanUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.scheduling.annotation.Async; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -56,6 +56,9 @@ public class CompanyServiceImpl implements ICompanyService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private CompanyPostMapper postMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private CompanyUserMapper userMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private CompanyRoleMenuMapper roleMenuMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private CompanyUserRoleMapper userRoleMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -149,16 +152,30 @@ public class CompanyServiceImpl implements ICompanyService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             post.setPostSort(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             post.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             postMapper.insertCompanyPost(post); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //创建角色 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CompanyRole role=new CompanyRole(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            role.setCompanyId(company.getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            role.setRoleName("管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            role.setRoleKey("admin"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            role.setRoleSort(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            role.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            roleMapper.insertCompanyRole(role); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //添加用户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CompanyUser user=new CompanyUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 创建管理员角色(拥有全部权限) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CompanyRole adminRole = new CompanyRole(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            adminRole.setCompanyId(company.getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            adminRole.setRoleName("管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            adminRole.setRoleKey("admin"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            adminRole.setRoleSort(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            adminRole.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            roleMapper.insertCompanyRole(adminRole); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 创建销售角色(新增部分,只有"我的"相关权限) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CompanyRole salesRole = new CompanyRole(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            salesRole.setCompanyId(company.getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            salesRole.setRoleName(company.getCompanyName() + "——销售"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            salesRole.setRoleKey("sales"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            salesRole.setRoleSort(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            salesRole.setDataScope("5"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            salesRole.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 注意:此处需要额外处理销售角色的权限,设置为仅"我的"相关权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 实际实现可能需要调用 permissionMapper 设置具体权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            roleMapper.insertCompanyRole(salesRole); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 6. 创建管理员用户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CompanyUser user = new CompanyUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             user.setCompanyId(company.getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             user.setNickName("管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -173,9 +190,25 @@ public class CompanyServiceImpl implements ICompanyService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             user.setIsDel(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             user.setIsAudit(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             userMapper.insertCompanyUser(user); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //增加菜单权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<CompanyRoleMenu> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String json = configService.selectConfigByKey("companymenu.config"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CompanyMenuConfig config = JSONUtil.toBean(json, CompanyMenuConfig.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            if (config!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (Long menuId : config.getMenuId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                CompanyRoleMenu rm = new CompanyRoleMenu(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                rm.setRoleId(adminRole.getRoleId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                rm.setMenuId(menuId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                list.add(rm); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            roleMenuMapper.batchRoleMenu(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //添加用户角色表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             CompanyUserRole userRole=new CompanyUserRole(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            userRole.setRoleId(role.getRoleId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userRole.setRoleId(adminRole.getRoleId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             userRole.setUserId(user.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             userRoleMapper.insertCompanyUserRole(userRole); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //添加用户岗位表 
			 |