Преглед изворни кода

feat: app用户不存在提示

weijianghai пре 3 месеци
родитељ
комит
0f09fb2aec

+ 3 - 0
src/main/java/com/nokia/dao/UserDao.java

@@ -319,4 +319,7 @@ public interface UserDao extends BaseMapper<User> {
             + "        and a.user_id = b.user_id)\n"
             + "    and city_id = #{cityId}")
     List<User> getManagersByCityId(@Param("cityId") Integer cityId);
+
+    @Select("select city_id from sqmdb_rpt.acl_top_user where login_name = #{loginName}")
+    Integer getAclTopUserCityId(@Param("loginName") String loginName);
 }

+ 24 - 3
src/main/java/com/nokia/service/AclService.java

@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.nokia.common.R;
 import com.nokia.common.exception.BizException;
 import com.nokia.constants.ClientEnum;
+import com.nokia.dao.AreaDao;
 import com.nokia.dao.UserDao;
 import com.nokia.dao.UserRoleCityDao;
 import com.nokia.dao.VerificationLogDao;
+import com.nokia.pojo.Area;
 import com.nokia.pojo.Notice;
 import com.nokia.pojo.User;
 import com.nokia.pojo.UserRoleCity;
@@ -69,11 +71,13 @@ public class AclService {
     private final UserRoleCityDao userRoleCityDao;
     private final NoticeService noticeService;
     private final FileService fileService;
+    private final AreaDao areaDao;
 
     @Autowired
     public AclService(UserDao userDao, TopService topService, DopService dopService, WoyunweiService woyunweiService,
                       RedisTemplate<String, Object> redisTemplate, VerificationLogDao verificationLogDao,
-                      UserRoleCityDao userRoleCityDao, NoticeService noticeService, FileService fileService) {
+                      UserRoleCityDao userRoleCityDao, NoticeService noticeService, FileService fileService,
+                      AreaDao areaDao) {
         this.userDao = userDao;
         this.topService = topService;
         this.dopService = dopService;
@@ -83,6 +87,7 @@ public class AclService {
         this.userRoleCityDao = userRoleCityDao;
         this.noticeService = noticeService;
         this.fileService = fileService;
+        this.areaDao = areaDao;
     }
 
     /**
@@ -145,6 +150,22 @@ public class AclService {
         // 前端需要对入口用户做特别的处理
         userEntity = userDao.getByLoginName(tokenFlagVo.getLoginName());
         if (userEntity == null || userEntity.getDeleted().equals(1)) {
+            // app查询acl_top_user,如果查不到返回省公司管理员联系电话,查到返回对应地市管理员联系电话
+            if ("app".equalsIgnoreCase(system)) {
+                Integer cityId = userDao.getAclTopUserCityId(tokenFlagVo.getLoginName());
+                // 省级用户提示,不想收短信手机号不正确,写死王玉龙手机号
+                if (cityId == null) {
+                    return R.error().message("用户不存在,请联系省公司管理员 18631112100");
+                }
+                Area area = areaDao.selectById(cityId);
+                // 地市级用户提示
+                String cityName = area.getAreaName().replace("市", "");
+                // 查询地市管理员
+                List<User> managers = userDao.getManagersByCityId(cityId);
+                String phones = managers.stream().map(User::getPhone).filter(StringUtils::hasText)
+                        .collect(Collectors.joining("/"));
+                return R.error().message("用户不存在,请联系" + cityName + "地市管理员 " + phones);
+            }
             return R.error().data(map).message("用户不存在");
         }
 
@@ -235,7 +256,7 @@ public class AclService {
                 if (CollectionUtils.isEmpty(appFunctions)) {
                     // 省级用户提示,不想收短信手机号不正确,写死王玉龙手机号
                     if (userEntity.getCityId() == -1) {
-                        return R.ok().data(appFunctions).message("用户无权限,请联系省公司管理员 18631112100");
+                        return R.ok().message("用户无权限,请联系省公司管理员 18631112100");
                     }
                     // 地市级用户提示
                     String cityName = userEntity.getCity().getAreaName().replace("市", "");
@@ -243,7 +264,7 @@ public class AclService {
                     List<User> managers = userDao.getManagersByCityId(userEntity.getCityId());
                     String phones = managers.stream().map(User::getPhone).filter(StringUtils::hasText)
                             .collect(Collectors.joining("/"));
-                    return R.ok().data(appFunctions).message("用户无权限,请联系" + cityName + "地市管理员 " + phones);
+                    return R.ok().message("用户无权限,请联系" + cityName + "地市管理员 " + phones);
                 }
                 return R.ok().data(appFunctions);
             case "web":