18792927508 2 lat temu
rodzic
commit
95a91b4189

+ 1
- 10
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java Wyświetl plik

@@ -2,12 +2,10 @@ package com.ruoyi;
2 2
 
3 3
 import cn.hutool.core.collection.CollectionUtil;
4 4
 import com.ruoyi.common.constant.CacheConstants;
5
-import com.ruoyi.common.core.domain.entity.SysDept;
6 5
 import com.ruoyi.common.core.domain.entity.SysRole;
7 6
 import com.ruoyi.common.core.domain.entity.SysUser;
8 7
 import com.ruoyi.common.core.redis.RedisCache;
9 8
 import com.ruoyi.common.utils.spring.SpringUtils;
10
-import com.ruoyi.system.mapper.SysDeptMapper;
11 9
 import com.ruoyi.system.mapper.SysRoleMapper;
12 10
 import com.ruoyi.system.mapper.SysUserMapper;
13 11
 import org.springframework.boot.SpringApplication;
@@ -59,13 +57,6 @@ public class RuoYiApplication
59 57
                 redisCache.setCacheObject(CacheConstants.ROLE_KEY+role.getRoleName(),role.getRoleId());
60 58
             }
61 59
         }
62
-        // 初始化部门redis
63
-        SysDeptMapper deptMapper = SpringUtils.getBean(SysDeptMapper.class);
64
-        List<SysDept> depts = deptMapper.selectDeptList(new SysDept());
65
-        if(CollectionUtil.isNotEmpty(depts)){
66
-            for (SysDept dept : depts) {
67
-                redisCache.setCacheObject(CacheConstants.DEPT_KEY+dept.getDeptName(),dept.getDeptId());
68
-            }
69
-        }
70 60
     }
61
+
71 62
 }

+ 1
- 4
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java Wyświetl plik

@@ -64,8 +64,5 @@ public class CacheConstants
64 64
      * 角色 redis key
65 65
      */
66 66
     public static final String ROLE_KEY = "role_key:";
67
-    /**
68
-     * 部门 redis key
69
-     */
70
-    public static final String DEPT_KEY = "dept_key:";
67
+
71 68
 }

+ 1
- 9
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java Wyświetl plik

@@ -2,7 +2,6 @@ package com.ruoyi.system.service.impl;
2 2
 
3 3
 import cn.hutool.core.collection.CollectionUtil;
4 4
 import com.ruoyi.common.annotation.DataScope;
5
-import com.ruoyi.common.constant.CacheConstants;
6 5
 import com.ruoyi.common.constant.UserConstants;
7 6
 import com.ruoyi.common.core.domain.TreeSelect;
8 7
 import com.ruoyi.common.core.domain.entity.SysDept;
@@ -231,7 +230,6 @@ public class SysDeptServiceImpl implements ISysDeptService
231 230
             dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
232 231
         }
233 232
         int i = deptMapper.insertDept(dept);
234
-        redisCache.setCacheObject(CacheConstants.DEPT_KEY+dept.getDeptName(),dept.getDeptId());
235 233
         return i;
236 234
     }
237 235
 
@@ -260,8 +258,6 @@ public class SysDeptServiceImpl implements ISysDeptService
260 258
             // 如果该部门是启用状态,则启用该部门的所有上级部门
261 259
             updateParentDeptStatusNormal(dept);
262 260
         }
263
-        // 修改缓存
264
-        redisCache.setCacheObject(CacheConstants.DEPT_KEY+dept.getDeptName(),dept.getDeptId());
265 261
         return result;
266 262
     }
267 263
 
@@ -311,11 +307,7 @@ public class SysDeptServiceImpl implements ISysDeptService
311 307
        if(CollectionUtil.isNotEmpty(caseList)){
312 308
            throw new ServiceException("该部门有关联案件,不允许删除");
313 309
        }
314
-        SysDept sysDept = deptMapper.selectDeptById(deptId);
315
-        if(sysDept!=null) {
316
-            // 删除缓存
317
-            redisCache.deleteObject(CacheConstants.DEPT_KEY + sysDept.getDeptName());
318
-        }
310
+
319 311
         return deptMapper.deleteDeptById(deptId);
320 312
     }
321 313
 

+ 7
- 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java Wyświetl plik

@@ -253,8 +253,7 @@ public class SysUserServiceImpl implements ISysUserService {
253 253
         user.setCreateBy("admin");
254 254
         user.setCreateTime(DateUtils.getNowDate());
255 255
         int rows = userMapper.insertUser(user);
256
-        // redis缓存
257
-        redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user);
256
+
258 257
         // 新增用户部门关联
259 258
         if(CollectionUtil.isNotEmpty(user.getDeptIds())) {
260 259
             // 先删除用户与部门关联
@@ -272,6 +271,8 @@ public class SysUserServiceImpl implements ISysUserService {
272 271
         insertUserPost(user);
273 272
         // 新增用户与角色管理
274 273
         insertUserRole(user);
274
+        // redis缓存
275
+        redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user);
275 276
         return AjaxResult.success("新建用户成功");
276 277
     }
277 278
 
@@ -322,6 +323,7 @@ public class SysUserServiceImpl implements ISysUserService {
322 323
         insertUserPost(user);
323 324
         userMapper.updateUser(user);
324 325
         // redis缓存
326
+        user=userMapper.selectUserById(userId);
325 327
         redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user);
326 328
         return AjaxResult.success("更新用户成功");
327 329
     }
@@ -349,7 +351,7 @@ public class SysUserServiceImpl implements ISysUserService {
349 351
     public int updateUserStatus(SysUser user) {
350 352
         int i = userMapper.updateUser(user);
351 353
         // redis缓存
352
-        redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user);
354
+       // redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user);
353 355
         return i;
354 356
     }
355 357
 
@@ -363,6 +365,7 @@ public class SysUserServiceImpl implements ISysUserService {
363 365
     public int updateUserProfile(SysUser user) {
364 366
         int i = userMapper.updateUser(user);
365 367
         // redis缓存
368
+        user=userMapper.selectUserById(user.getUserId());
366 369
         redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user);
367 370
         return i;
368 371
     }
@@ -388,8 +391,6 @@ public class SysUserServiceImpl implements ISysUserService {
388 391
     @Override
389 392
     public int resetPwd(SysUser user) {
390 393
         int i = userMapper.updateUser(user);
391
-        // redis缓存
392
-        redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user);
393 394
         return i;
394 395
     }
395 396
 
@@ -554,6 +555,7 @@ public class SysUserServiceImpl implements ISysUserService {
554 555
                     user.setUpdateBy(operName);
555 556
                     userMapper.updateUser(user);
556 557
                     // redis缓存
558
+                    user=userMapper.selectUserById(user.getUserId());
557 559
                     redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user);
558 560
                     successNum++;
559 561
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");

+ 1
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java Wyświetl plik

@@ -160,6 +160,7 @@ public class WeChatUserServiceImpl implements WeChatUserService {
160 160
             sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord()));
161 161
             sysUserMapper.updateUser(sysUser);
162 162
             // redis缓存
163
+            sysUser=sysUserMapper.selectUserById(sysUser.getUserId());
163 164
             redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser);
164 165
             ientityAuthentication.setUserId(sysUser.getUserId());
165 166
             int count=0;

+ 2
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Wyświetl plik

@@ -223,14 +223,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
223 223
         example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
224 224
         List<MsCaseFlowRoleRelated> caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example);
225 225
         if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) {
226
-            throw new ServiceException("该角色绑定案件流程");
226
+            throw new ServiceException("该角色绑定案件流程");
227 227
         }
228 228
 
229 229
         Example flowExample = new Example(MsCaseFlow.class);
230 230
         flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList()));
231 231
         List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
232 232
         if (CollectionUtil.isEmpty(caseFlows)) {
233
-            throw new ServiceException("该角色绑定案件流程");
233
+            throw new ServiceException("该角色绑定案件流程");
234 234
         }
235 235
         List<Integer> caseFlowIds = caseFlows.stream().map(MsCaseFlow::getId).collect(Collectors.toList());
236 236
         // 流程名称分组