Browse Source

bug修复

18792927508 2 years ago
parent
commit
95a91b4189

+ 1
- 10
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java View File

2
 
2
 
3
 import cn.hutool.core.collection.CollectionUtil;
3
 import cn.hutool.core.collection.CollectionUtil;
4
 import com.ruoyi.common.constant.CacheConstants;
4
 import com.ruoyi.common.constant.CacheConstants;
5
-import com.ruoyi.common.core.domain.entity.SysDept;
6
 import com.ruoyi.common.core.domain.entity.SysRole;
5
 import com.ruoyi.common.core.domain.entity.SysRole;
7
 import com.ruoyi.common.core.domain.entity.SysUser;
6
 import com.ruoyi.common.core.domain.entity.SysUser;
8
 import com.ruoyi.common.core.redis.RedisCache;
7
 import com.ruoyi.common.core.redis.RedisCache;
9
 import com.ruoyi.common.utils.spring.SpringUtils;
8
 import com.ruoyi.common.utils.spring.SpringUtils;
10
-import com.ruoyi.system.mapper.SysDeptMapper;
11
 import com.ruoyi.system.mapper.SysRoleMapper;
9
 import com.ruoyi.system.mapper.SysRoleMapper;
12
 import com.ruoyi.system.mapper.SysUserMapper;
10
 import com.ruoyi.system.mapper.SysUserMapper;
13
 import org.springframework.boot.SpringApplication;
11
 import org.springframework.boot.SpringApplication;
59
                 redisCache.setCacheObject(CacheConstants.ROLE_KEY+role.getRoleName(),role.getRoleId());
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 View File

64
      * 角色 redis key
64
      * 角色 redis key
65
      */
65
      */
66
     public static final String ROLE_KEY = "role_key:";
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 View File

2
 
2
 
3
 import cn.hutool.core.collection.CollectionUtil;
3
 import cn.hutool.core.collection.CollectionUtil;
4
 import com.ruoyi.common.annotation.DataScope;
4
 import com.ruoyi.common.annotation.DataScope;
5
-import com.ruoyi.common.constant.CacheConstants;
6
 import com.ruoyi.common.constant.UserConstants;
5
 import com.ruoyi.common.constant.UserConstants;
7
 import com.ruoyi.common.core.domain.TreeSelect;
6
 import com.ruoyi.common.core.domain.TreeSelect;
8
 import com.ruoyi.common.core.domain.entity.SysDept;
7
 import com.ruoyi.common.core.domain.entity.SysDept;
231
             dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
230
             dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
232
         }
231
         }
233
         int i = deptMapper.insertDept(dept);
232
         int i = deptMapper.insertDept(dept);
234
-        redisCache.setCacheObject(CacheConstants.DEPT_KEY+dept.getDeptName(),dept.getDeptId());
235
         return i;
233
         return i;
236
     }
234
     }
237
 
235
 
260
             // 如果该部门是启用状态,则启用该部门的所有上级部门
258
             // 如果该部门是启用状态,则启用该部门的所有上级部门
261
             updateParentDeptStatusNormal(dept);
259
             updateParentDeptStatusNormal(dept);
262
         }
260
         }
263
-        // 修改缓存
264
-        redisCache.setCacheObject(CacheConstants.DEPT_KEY+dept.getDeptName(),dept.getDeptId());
265
         return result;
261
         return result;
266
     }
262
     }
267
 
263
 
311
        if(CollectionUtil.isNotEmpty(caseList)){
307
        if(CollectionUtil.isNotEmpty(caseList)){
312
            throw new ServiceException("该部门有关联案件,不允许删除");
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
         return deptMapper.deleteDeptById(deptId);
311
         return deptMapper.deleteDeptById(deptId);
320
     }
312
     }
321
 
313
 

+ 7
- 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java View File

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

+ 1
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java View File

160
             sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord()));
160
             sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord()));
161
             sysUserMapper.updateUser(sysUser);
161
             sysUserMapper.updateUser(sysUser);
162
             // redis缓存
162
             // redis缓存
163
+            sysUser=sysUserMapper.selectUserById(sysUser.getUserId());
163
             redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser);
164
             redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser);
164
             ientityAuthentication.setUserId(sysUser.getUserId());
165
             ientityAuthentication.setUserId(sysUser.getUserId());
165
             int count=0;
166
             int count=0;

+ 2
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java View File

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