tjf пре 1 месец
родитељ
комит
7beeafa758

+ 3 - 1
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/Constants.java

@@ -108,10 +108,12 @@ public interface Constants {
     //web首页统计当月违停车辆数量
     String NOW_MONTH_ILLEGAL_CAR = "now_month_illegal_car:";
     //--------------------app首页统计的key----------------
-//用户个人报修维修未完成的数量property_repair_no:{userId} KEY=数量
+    //用户个人报修维修未完成的数量property_repair_no:{userId} KEY=数量
     String PROPERTY_REPAIR_NO = "property_repair_no:";
     //维修未完成的总数量 property_repair_no_all: KEY=数量
     String PROPERTY_REPAIR_NO_ALL = "property_repair_no_all:";
+    //维修人员未完成的数量 property_repair_staff_no:{userId=维修人员的userId}
+    String PROPERTY_REPAIR_STAFF_NO = "property_repair_staff_no:";
     //用户个人投诉建议未回复的数量 complaint_suggestion_no:{userId} KEY=数量
     String COMPLAINT_SUGGESTION_NO = "complaint_suggestion_no:";
     //投诉建议未回复的总数量

+ 25 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/service/impl/PropertyRepairServiceImpl.java

@@ -149,12 +149,20 @@ public class PropertyRepairServiceImpl implements IPropertyRepairService {
         validEntityBeforeSave(update);
         Long userId = getUserId();
         String repairStatus = update.getRepairStatus();
+
         if (FOR.equals(repairStatus)) {
+            Long staffUserId = update.getStaffUserId();
             //判断如果维修完成,把维修人员的状态改成空闲
             StaffManage staffManage = new StaffManage();
             staffManage.setStaffId(update.getStaffId());
             staffManage.setStatus(ONE);
             staffManageMapper.updateById(staffManage);
+            //修改维修人员待维系的数量
+            String key = PROPERTY_REPAIR_STAFF_NO + staffUserId;
+            if (RedisUtils.hasKey(key)) {
+                Object count = RedisUtils.getCacheObject(key);
+                RedisUtils.setCacheObject(key, Math.max(Integer.parseInt(count.toString()) - 1, 0));
+            }
             String userRepairKey = PROPERTY_REPAIR_NO + userId;
             //往redis中新增 个人 物业未完成的报修数量 app统计使用
             Object userNum = RedisUtils.getCacheObject(userRepairKey);
@@ -196,6 +204,14 @@ public class PropertyRepairServiceImpl implements IPropertyRepairService {
                 for (Long id : ids) {
                     PropertyRepair propertyRepair = baseMapper.selectById(id);
                     Long userId = propertyRepair.getUserId();
+                    Long staffUserId = propertyRepair.getStaffUserId();
+                    if (staffUserId != null && !propertyRepair.getRepairStatus().equals(FOR)) {
+                        String key = PROPERTY_REPAIR_STAFF_NO + staffUserId;
+                        if (RedisUtils.hasKey(key)) {
+                            Object count = RedisUtils.getCacheObject(key);
+                            RedisUtils.setCacheObject(key, Math.max(Integer.parseInt(count.toString()) - 1, 0));
+                        }
+                    }
                     //删除redis中的数据
                     String userRepairKey = PROPERTY_REPAIR_NO + userId;
                     //往redis中新增 个人 物业未完成的报修数量 app统计使用
@@ -229,6 +245,15 @@ public class PropertyRepairServiceImpl implements IPropertyRepairService {
         if (TWO.equals(staffManageOld.getStatus())) {
             return R.fail("当前人员处于不在空闲状态无法指派");
         }
+        //指派还需要记录维修人员需要维修的数量
+        Long staffUserId = propertyRepair.getStaffUserId();
+        String key = PROPERTY_REPAIR_STAFF_NO + staffUserId;
+        if (RedisUtils.hasKey(key)) {
+            Object count = RedisUtils.getCacheObject(key);
+            RedisUtils.setCacheObject(key, Integer.parseInt(count.toString()) + 1);
+        } else {
+            RedisUtils.setCacheObject(key, 1);
+        }
         //报修ID/维修人员姓名/维修人员ID/维修人员手机号
         //指派后修改该物业报修表的状态的
         propertyRepair.setRepairStatus(TWO);

+ 7 - 5
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/service/impl/ResidentInfoServiceImpl.java

@@ -550,9 +550,11 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
         //居住人员待认证数量-1
         if (RedisUtils.hasKey(RESIDENT_INFO_AUTHENTICATION)) {
             Object count = RedisUtils.getCacheObject(RESIDENT_INFO_AUTHENTICATION);
-            RedisUtils.setCacheObject(RESIDENT_INFO_AUTHENTICATION, Math.max(Integer.parseInt(count.toString()), 0));
+            RedisUtils.setCacheObject(RESIDENT_INFO_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
         }
-        return baseMapper.deleteByIds(ids) > 0;
+        return TenantHelper.ignore(() -> {
+            return baseMapper.deleteByIds(ids) > 0;
+        });
     }
 
     /**
@@ -648,13 +650,13 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
             //居住人员待认证数量-1
             if (RedisUtils.hasKey(RESIDENT_INFO_AUTHENTICATION)) {
                 Object count = RedisUtils.getCacheObject(RESIDENT_INFO_AUTHENTICATION);
-                RedisUtils.setCacheObject(RESIDENT_INFO_AUTHENTICATION, Math.max(Integer.parseInt(count.toString()), 0));
+                RedisUtils.setCacheObject(RESIDENT_INFO_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
             }
         } else if (THR.equals(residentInfo.getExamine())) {
             //居住人员待认证数量-1
             if (RedisUtils.hasKey(RESIDENT_INFO_AUTHENTICATION)) {
                 Object count = RedisUtils.getCacheObject(RESIDENT_INFO_AUTHENTICATION);
-                RedisUtils.setCacheObject(RESIDENT_INFO_AUTHENTICATION, Math.max(Integer.parseInt(count.toString()), 0));
+                RedisUtils.setCacheObject(RESIDENT_INFO_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
             }
         }
         return baseMapper.updateById(residentInfo) > 0;
@@ -764,7 +766,7 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
                 //居住人员待认证数量-1
                 if (RedisUtils.hasKey(RESIDENT_INFO_AUTHENTICATION)) {
                     Object count = RedisUtils.getCacheObject(RESIDENT_INFO_AUTHENTICATION);
-                    RedisUtils.setCacheObject(RESIDENT_INFO_AUTHENTICATION, Math.max(Integer.parseInt(count.toString()), 0));
+                    RedisUtils.setCacheObject(RESIDENT_INFO_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
                 }
             }
         } else {

+ 37 - 35
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/service/impl/StaffManageServiceImpl.java

@@ -94,8 +94,8 @@ public class StaffManageServiceImpl implements IStaffManageService {
      * @return
      */
     @Override
-    public StaffManageVo getInfoByUserId(Long userId,String tenantId) {
-        return baseMapper.getInfoByUserId(userId,tenantId);
+    public StaffManageVo getInfoByUserId(Long userId, String tenantId) {
+        return baseMapper.getInfoByUserId(userId, tenantId);
     }
 
     /**
@@ -173,11 +173,11 @@ public class StaffManageServiceImpl implements IStaffManageService {
             validEntityBeforeSave(add);
             flag = baseMapper.insert(add) > 0;
             //待认证的员工人员数量,统计使用
-            if(RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)){
+            if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)) {
                 Object count = RedisUtils.getCacheObject(STAFF_MANAGE_AUTHENTICATION);
-                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION,Integer.parseInt(count.toString())+1);
-            }else {
-                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION,1);
+                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION, Integer.parseInt(count.toString()) + 1);
+            } else {
+                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION, 1);
             }
 /*
             SysUserBo sysUser = new SysUserBo();
@@ -230,7 +230,7 @@ public class StaffManageServiceImpl implements IStaffManageService {
             user.setUserType(APP_STAFF.getUserType() + "," + PC_USER.getUserType());
             boolean exist = TenantHelper.ignore(() -> {
                 return userMapper.exists(new LambdaQueryWrapper<SysUser>()
-                        .eq(SysUser::getUserName, user.getUserName()));
+                    .eq(SysUser::getUserName, user.getUserName()));
             });
             SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
             sysUser.setTenantId(tenantId);
@@ -251,9 +251,9 @@ public class StaffManageServiceImpl implements IStaffManageService {
                 userId = sysUserVo.getUserId();
                 String userType = sysUserVo.getUserType();
                 if (!userType.contains(APP_STAFF.getUserType())) {
-                    userType = userType+ "," + APP_STAFF.getUserType();
-                }else if (!userType.contains(PC_USER.getUserType())) {
-                    userType = userType+ "," + PC_USER.getUserType();
+                    userType = userType + "," + APP_STAFF.getUserType();
+                } else if (!userType.contains(PC_USER.getUserType())) {
+                    userType = userType + "," + PC_USER.getUserType();
                 }
                 sysUser.setUserType(userType);
                 sysUser.setIsAuthentication(THR);
@@ -313,13 +313,13 @@ public class StaffManageServiceImpl implements IStaffManageService {
     @Override
     public Boolean updateByBo(StaffManageBo bo) {
         StaffManage update = MapstructUtils.convert(bo, StaffManage.class);
-       if (THR.equals(update.getExamine())){
-           //员工待认证数量-1
-           if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)){
-               Object count = RedisUtils.getCacheObject(STAFF_MANAGE_AUTHENTICATION);
-               RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION,Math.max(Integer.parseInt(count.toString()),0));
-           }
-       }
+        if (THR.equals(update.getExamine())) {
+            //员工待认证数量-1
+            if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)) {
+                Object count = RedisUtils.getCacheObject(STAFF_MANAGE_AUTHENTICATION);
+                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
+            }
+        }
         update.setExamine(ONE);
         if (bo.getIsFilter()) {
             return TenantHelper.ignore(() -> {
@@ -397,11 +397,13 @@ public class StaffManageServiceImpl implements IStaffManageService {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         //员工待认证数量-1
-        if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)){
+        if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)) {
             Object count = RedisUtils.getCacheObject(STAFF_MANAGE_AUTHENTICATION);
-            RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION,Math.max(Integer.parseInt(count.toString()),0));
+            RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
         }
-        return baseMapper.deleteByIds(ids) > 0;
+        return TenantHelper.ignore(() -> {
+            return baseMapper.deleteByIds(ids) > 0;
+        });
     }
 
 
@@ -436,9 +438,9 @@ public class StaffManageServiceImpl implements IStaffManageService {
                 }
                 String userType = sysUserVo.getUserType();
                 if (!userType.contains(APP_STAFF.getUserType())) {
-                    userType = userType+ "," + APP_STAFF.getUserType();
-                }else if (!userType.contains(PC_USER.getUserType())) {
-                    userType = userType+ "," + PC_USER.getUserType();
+                    userType = userType + "," + APP_STAFF.getUserType();
+                } else if (!userType.contains(PC_USER.getUserType())) {
+                    userType = userType + "," + PC_USER.getUserType();
                 }
                 sysUser.setUserType(userType);
                 userService.updateUserByIdNoTenantId(sysUser);
@@ -478,15 +480,15 @@ public class StaffManageServiceImpl implements IStaffManageService {
             }*/
 
             //员工待认证数量-1
-            if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)){
+            if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)) {
                 Object count = RedisUtils.getCacheObject(STAFF_MANAGE_AUTHENTICATION);
-                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION,Math.max(Integer.parseInt(count.toString()),0));
+                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
             }
-        }else if (THR.equals(examine)){
+        } else if (THR.equals(examine)) {
             //员工待认证数量-1
-            if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)){
+            if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)) {
                 Object count = RedisUtils.getCacheObject(STAFF_MANAGE_AUTHENTICATION);
-                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION,Math.max(Integer.parseInt(count.toString()),0));
+                RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
             }
         }
         return baseMapper.updateById(examineStaffManage) > 0;
@@ -522,7 +524,7 @@ public class StaffManageServiceImpl implements IStaffManageService {
             });
             // 删除用户与租户关联
             TenantHelper.ignore(() -> {
-                sysUserTenantMapper.updateByTenantId(tenantId,userId,ONE);
+                sysUserTenantMapper.updateByTenantId(tenantId, userId, ONE);
             });
 /*            if (staffManageList != null && !staffManageList.isEmpty()) {
                 //判断用户的默认租户是否是被删除的那个租户,是的情况下换一个租户id给sysUser表中
@@ -552,16 +554,16 @@ public class StaffManageServiceImpl implements IStaffManageService {
                         sysUser.setIsAuthentication(TWO);
                         sysUser.setTenantId(list.get(0).getTenantId());
                     }
-                }else {
+                } else {
                     //一个居住人员都没有,说明该用户一个认证信息都没有提交
                     sysUser.setIsAuthentication(ONE);
                 }
-            }else {
+            } else {
                 //说明还有认证过的员工信息
                 List<StaffManage> list = staffManageList.stream().filter(e -> e.getExamine().equals(TWO)).toList();
                 if (!list.isEmpty()) {
                     sysUser.setTenantId(list.get(0).getTenantId());
-                }else {
+                } else {
                     //如果一个员工通过的都没有,去查询是否有居住人员认证通过的
                     List<ResidentInfoVo> infoByUserId = residentInfoMapper.getInfoByUserId(userId);
                     if (infoByUserId != null && !infoByUserId.isEmpty()) {
@@ -570,7 +572,7 @@ public class StaffManageServiceImpl implements IStaffManageService {
                             sysUser.setIsAuthentication(TWO);
                             sysUser.setTenantId(residentInfoVoList.get(0).getTenantId());
                         }
-                    }else {
+                    } else {
                         //一个居住人员都没有,说明该用户一个认证信息都没有提交
                         sysUser.setIsAuthentication(ONE);
                     }
@@ -583,9 +585,9 @@ public class StaffManageServiceImpl implements IStaffManageService {
 
             if (ONE.equals(examine)) {
                 //员工待认证数量-1
-                if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)){
+                if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)) {
                     Object count = RedisUtils.getCacheObject(STAFF_MANAGE_AUTHENTICATION);
-                    RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION,Math.max(Integer.parseInt(count.toString()),0));
+                    RedisUtils.setCacheObject(STAFF_MANAGE_AUTHENTICATION, Math.max(Integer.parseInt(count.toString())-1, 0));
                 }
             }
         } else {

+ 15 - 6
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/service/impl/StatisticsServiceImpl.java

@@ -170,16 +170,25 @@ public class StatisticsServiceImpl implements IStatisticsService {
     public R<Map<String, Object>> wuYeTips(StaffManage staffManage) {
         Map<String, Object> map = new HashMap<>(3);
         Long userId = staffManage.getUserId();
+
         //物业报修未完成的数量 投诉建议未回复的数量 社区资讯未读数量
-        Object repairNum = RedisUtils.getCacheObject(PROPERTY_REPAIR_NO_ALL);
         map.put("propertyRepair", 0);
-        if (ObjectUtils.isNotEmpty(repairNum)) {
-            map.put("propertyRepair", repairNum);
+        if (userId != null) {
+            String key = PROPERTY_REPAIR_STAFF_NO + userId;
+            if (RedisUtils.hasKey(key)) {
+                Object repairNum = RedisUtils.getCacheObject(key);
+                map.put("propertyRepair", repairNum);
+            }
+        } else {
+            Object repairNum = RedisUtils.getCacheObject(PROPERTY_REPAIR_NO_ALL);
+            if (ObjectUtils.isNotEmpty(repairNum)) {
+                map.put("propertyRepair", repairNum);
+            }
         }
         //投诉建议未回复的数量
         Object complaintSuggestionNum = RedisUtils.getCacheObject(COMPLAINT_SUGGESTION_NO_ALL);
         map.put("complaintSuggestion", 0);
-        if (ObjectUtils.isNotEmpty(repairNum)) {
+        if (ObjectUtils.isNotEmpty(complaintSuggestionNum)) {
             map.put("complaintSuggestion", complaintSuggestionNum);
         }
         //查询社区资讯未读互动数量
@@ -191,13 +200,13 @@ public class StatisticsServiceImpl implements IStatisticsService {
         }
         //员工未认证的数量
         map.put("staffManageAuthenticationCount", 0);
-        if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)){
+        if (RedisUtils.hasKey(STAFF_MANAGE_AUTHENTICATION)) {
             Object count = RedisUtils.getCacheObject(STAFF_MANAGE_AUTHENTICATION);
             map.put("staffManageAuthenticationCount", count);
         }
         //居住人员未认证的数量
         map.put("residentInfoAuthenticationCount", 0);
-        if (RedisUtils.hasKey(RESIDENT_INFO_AUTHENTICATION)){
+        if (RedisUtils.hasKey(RESIDENT_INFO_AUTHENTICATION)) {
             Object count = RedisUtils.getCacheObject(RESIDENT_INFO_AUTHENTICATION);
             map.put("residentInfoAuthenticationCount", count);
         }