|  |  | 
 |  |  | import com.zt.common.utils.TreeUtils; | 
 |  |  | import com.zt.core.context.User; | 
 |  |  | import com.zt.core.context.UserContext; | 
 |  |  | import com.zt.core.oss.service.ISysOssConfigService; | 
 |  |  | import com.zt.core.oss.service.ISysOssService; | 
 |  |  | import com.zt.core.security.BCryptPasswordEncoder; | 
 |  |  | import com.zt.core.security.Md5Utils; | 
 |  |  | import com.zt.core.sys.model.SysDept; | 
 |  |  | import com.zt.core.sys.model.SysUser; | 
 |  |  | import com.zt.core.sys.service.ISysUserService; | 
 |  |  | import com.zt.life.sys.dto.OssDto; | 
 |  |  | import com.zt.modules.sys.dao.SysUserDao; | 
 |  |  | import com.zt.modules.sys.dto.RoleDto; | 
 |  |  | import com.zt.modules.sys.dto.UserTreeDto; | 
 |  |  | 
 |  |  | import org.springframework.beans.factory.annotation.Value; | 
 |  |  | import org.springframework.cache.annotation.CacheEvict; | 
 |  |  | import org.springframework.cache.annotation.Cacheable; | 
 |  |  | import org.springframework.context.annotation.Lazy; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | 
 |  |  |     private SysDeptService sysDeptService; | 
 |  |  |     @Autowired | 
 |  |  |     private SysParamsService paramsService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     SysMapService sysMapService; | 
 |  |  |     @Autowired | 
 |  |  |     private ISysOssConfigService sysOssConfigService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public List<SysUser> page(QueryFilter queryFilter) { | 
 |  |  |         // 普通管理员,只能查询所属部门及子部门的数据 | 
 |  |  | 
 |  |  |         if (!user.isSuperAdmin()) { | 
 |  |  |             queryFilter.addParam("deptIds", sysDeptService.getWithDescendantIds(user.getDeptId())); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 查询 | 
 |  |  |         return queryFilter.getPageList(baseDao.getList(queryFilter.getParams())); | 
 |  |  |     } | 
 |  |  | 
 |  |  |         if (!user.isSuperAdmin()) { | 
 |  |  |             queryFilter.addParam("deptIds", sysDeptService.getWithDescendantIds(user.getDeptId())); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return baseDao.getList(queryFilter.getParams()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     @Override | 
 |  |  |     @Cacheable(value = Constant.Cache.USER, key = "'id:' + #id") | 
 |  |  |     public SysUser get(Long id) { | 
 |  |  |         SysUser entity = baseDao.getEntity(id); | 
 |  |  |         return entity; | 
 |  |  |         //return super.get(id); | 
 |  |  | /*        SysUser entity = baseDao.getEntity(id); | 
 |  |  |         return entity;*/ | 
 |  |  |         return super.get(id); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  | 
 |  |  |  | 
 |  |  |         entity.setCompanyId(sysDeptService.getCompanyIdByDeptId(entity.getDeptId())); | 
 |  |  |         // 保存用户 | 
 |  |  |         sysOssConfigService.updateOss(entity.getId(), entity.getFiles()); | 
 |  |  |         sysOssConfigService.updateOss(entity.getId(), entity.getFiles2()); | 
 |  |  |         super.insert(entity); | 
 |  |  |  | 
 |  |  |         sysPostUserService.saveOrUpdate(entity.getId(), entity.getPostIdList()); | 
 |  |  | 
 |  |  |     public void update(SysUser entity) { | 
 |  |  |         // 更新用户 | 
 |  |  |         entity.setCompanyId(sysDeptService.getCompanyIdByDeptId(entity.getDeptId())); | 
 |  |  |         sysOssConfigService.updateOss(entity.getId(), entity.getFiles()); | 
 |  |  |         sysOssConfigService.updateOss(entity.getId(), entity.getFiles2()); | 
 |  |  |         super.update(entity); | 
 |  |  |  | 
 |  |  |         // 保存岗位用户关系 | 
 |  |  | 
 |  |  |         return num; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public SysUser getUsersList() { | 
 |  |  |     public List<SysUser> getUsersList() { | 
 |  |  |         return baseDao.getUsersList(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getUsersName(Long id) { | 
 |  |  |         return baseDao.getUsersName(id); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public SysUser getUserInfo(Long id) { | 
 |  |  |         SysUser data = super.get(id); | 
 |  |  |         if (data != null) { | 
 |  |  |             OssDto ossDto= sysOssConfigService.getOssByBusiType(data.getId() , "users_avatar"); | 
 |  |  |             if (ossDto != null) { | 
 |  |  |                 data.setFiles(ossDto); | 
 |  |  |             } | 
 |  |  |             OssDto ossDto2= sysOssConfigService.getOssByBusiType(data.getId() , "users_sign"); | 
 |  |  |             if (ossDto2 != null) { | 
 |  |  |                 data.setFiles2(ossDto2); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return data; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |