From 1772fc5e211f9e9e0ab4cdc6c29b436aac178c2a Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期五, 23 二月 2024 12:19:55 +0800 Subject: [PATCH] 修改 --- zt/core/src/main/java/com/zt/modules/sys/service/SysUserService.java | 88 +++++++++++++++++++++++++------------------- 1 files changed, 50 insertions(+), 38 deletions(-) diff --git a/zt/core/src/main/java/com/zt/modules/sys/service/SysUserService.java b/zt/core/src/main/java/com/zt/modules/sys/service/SysUserService.java index 08b9197..1c2ecc2 100644 --- a/zt/core/src/main/java/com/zt/modules/sys/service/SysUserService.java +++ b/zt/core/src/main/java/com/zt/modules/sys/service/SysUserService.java @@ -21,11 +21,14 @@ 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; @@ -34,6 +37,7 @@ 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; @@ -58,9 +62,12 @@ private SysDeptService sysDeptService; @Autowired private SysParamsService paramsService; - @Autowired SysMapService sysMapService; + @Autowired + private ISysOssConfigService sysOssConfigService; + + public List<SysUser> page(QueryFilter queryFilter) { // 鏅�氱鐞嗗憳锛屽彧鑳芥煡璇㈡墍灞為儴闂ㄥ強瀛愰儴闂ㄧ殑鏁版嵁 @@ -68,7 +75,6 @@ if (!user.isSuperAdmin()) { queryFilter.addParam("deptIds", sysDeptService.getWithDescendantIds(user.getDeptId())); } - // 鏌ヨ return queryFilter.getPageList(baseDao.getList(queryFilter.getParams())); } @@ -79,7 +85,6 @@ if (!user.isSuperAdmin()) { queryFilter.addParam("deptIds", sysDeptService.getWithDescendantIds(user.getDeptId())); } - return baseDao.getList(queryFilter.getParams()); } @@ -122,9 +127,9 @@ @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); } /** @@ -161,6 +166,8 @@ 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()); @@ -173,6 +180,8 @@ 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); // 淇濆瓨宀椾綅鐢ㄦ埛鍏崇郴 @@ -253,43 +262,11 @@ Map<String, Object> sysUser = new Hashtable(); sysUser.put("isAdmin", false); - sysUser.put("isTyRole", false); - sysUser.put("isYwzRole", false); - sysUser.put("isTzRole", false); sysUser.put("isAssistant", false); - sysUser.put("isCzRole", false); - sysUser.put("isBzRole", false); - sysUser.put("isCjRole", false); - sysUser.put("isZcRole", false); List<RoleDto> roles = sysRoleUserService.getUserRoles(UserContext.getUser().getId()); if (roles != null && roles.size() > 0) { if (roles.stream().filter(p -> p.getCode().equals("xtglybm") || p.getCode().equals("all")).count() > 0) { sysUser.put("isAdmin", true); - } - if (roles.stream().filter(p -> p.getCode().equals("tybm")).count() > 0) { - sysUser.put("isTyRole", true); - } - if (roles.stream().filter(p -> p.getCode().equals("ywzbm")).count() > 0) { - sysUser.put("isYwzRole", true); - } - if (roles.stream().filter(p -> p.getCode().equals("tzbm")).count() > 0) { - sysUser.put("isTzRole", true); - } - if (roles.stream().filter(p -> p.getCode().equals("zlbm")).count() > 0) { - sysUser.put("isAssistant", true); - } - if (roles.stream().filter(p -> p.getCode().equals("czbm")).count() > 0) { - sysUser.put("isCzRole", true); - } - if (roles.stream().filter(p -> p.getCode().equals("bzbm")).count() > 0) { - sysUser.put("isBzRole", true); - } - - if (roles.stream().filter(p -> p.getCode().equals("cjbm") || p.getCode().equals("zcbm")).count() > 0) { - sysUser.put("isCjRole", true); - } - if (roles.stream().filter(p -> p.getCode().equals("zcbm")).count() > 0) { - sysUser.put("isZcRole", true); } } return sysUser; @@ -321,4 +298,39 @@ Integer num = baseDao.checkTestHome(systemId,userId); return num; } + + public List<SysUser> getUsersList(String type, String deptId) { + List<SysUser> list = baseDao.getUsersList(type,deptId); + return list; + } + + public String getUsersName(String id) { + return baseDao.getUsersName(id); + } + + public String getNames(String ids) { + String[] NamesData = ids.split(","); + List<String> nameList =new ArrayList<>(); + for (String item : NamesData) { + nameList.add(this.getUsersName(item)); + } + String names = String.join(", ", nameList); + return names; + } + 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; + } + + } -- Gitblit v1.9.1