Browse Source

feat: app无权限提示

weijianghai 8 tháng trước cách đây
mục cha
commit
be17d4e3a4

+ 8 - 0
doc/部署文档/正式环境/正式环境部署文档.md

@@ -1,5 +1,13 @@
 # 正式环境部署文档
 
+## 部署位置
+
+jar: 192.168.70.125/data1/acl
+
+web: 192.168.70.125/data1/acl_web
+
+url: https://133.96.94.108:12041/#/home?token=test_token_hebei&fromSystem=test
+
 ## v1.10部署
 
 20220815完成部署,仅更新jar包,不需更新数据库

+ 4 - 0
doc/部署文档/测试环境/测试环境部署文档.md

@@ -8,6 +8,10 @@
 
 bin 部署位置 192.168.50.3:/data1/acl/
 
+web 部署位置:192.168.50.3/data/doweb_new
+
+url:https://192.168.50.3:12041/#/home?token=test_token_hebei&fromSystem=test
+
 ```sh
 #  放开端口访问
 sudo iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 12128 -j ACCEPT

+ 83 - 0
doc/需求文档/app无权限弹窗优化方案.md

@@ -0,0 +1,83 @@
+# app无权限弹窗优化方案
+
+## 需求背景
+
+当前APP是H5页面的形式集成在集团联通网络APP上,入口是在同样集成在该APP上的TOP的页面上。
+
+哪些用户可以看到该入口是由TOP的系统决定的,我们自己的系统无法控制。
+
+用户点击入口图标后,打开投诉系统app的入口页面,入口页面根据该用户的权限会显示相应的工作入口(工单答复、工单处理、工单查询)
+
+存在一种特殊情况,该用户在投诉系统中没有以上任何一种权限,此时会给出错误提醒,提示用户存在权限问题,需要联系管理员增加权限。
+
+当前的提示为: 用户无权限,请联系管理员!
+
+应客户要求,需要在此提示中增加联系人号码。
+
+## 方案说明
+
+### 前端调整方案
+
+前端将提醒由固定字符串修改为从后端鉴权接口获取到的动态消息字段。
+
+> 为了方便无权限用户退出投诉系统app页面,在弹窗上增加按钮,点击按钮后退出投诉系统,返回TOP。
+
+### 后端调整方案
+
+后端修改鉴权接口,在用户无权限时,根据用户归属地市返回包含对应地市或省公司管理员电话的提示消息字段。
+
+归属为地市的用户消息提示模板如下:
+
+用户无权限,请联系XX地市管理员 管理员1号码/管理员2号码
+
+归属为省公司的用户消息提示模板如下:
+
+用户无权限,请联系省公司管理员 管理员1号码/管理员2号码
+
+> 如果地市存在多个具有管理权限的账号,用/隔开多个手机号码
+
+#### 鉴权接口修改后
+
+- 在用户拥有权限时没有变化
+
+```json
+{
+    "success": true,
+    "code": 1,
+    "message": "成功",
+    "data": [
+        {
+            "id": 3,
+            "name": "工单答复",
+            "url": "/pages/index/index?type=reply&fromSystem=test&token=test_token_hebei",
+            "appIcon": "icon3",
+            "priority": 99
+        },
+        {
+            "id": 1,
+            "name": "工单处理",
+            "url": "/pages/index/index?type=dispose&fromSystem=test&token=test_token_hebei",
+            "appIcon": "icon1",
+            "priority": 88
+        },
+        {
+            "id": 2,
+            "name": "工单查询",
+            "url": "/pages/index/index?type=query&fromSystem=test&token=test_token_hebei",
+            "appIcon": "icon2",
+            "priority": 77
+        }
+    ]
+}
+```
+
+- 用户权限为空时,message字段修改为对用户的消息提醒。
+
+```json
+{
+    "success": true,
+    "code": 1,
+    "message": "用户无权限,请联系廊坊地市管理员 13211111111",
+    "data": []
+}
+```

+ 5 - 1
src/main/java/com/nokia/controller/VerificationController.java

@@ -2,6 +2,7 @@ package com.nokia.controller;
 
 import com.nokia.common.R;
 import com.nokia.service.AclService;
+import com.nokia.vo.AppVerificationVo;
 import com.nokia.vo.TokenVo;
 import com.nokia.vo.WebVerificationVo;
 import io.swagger.v3.oas.annotations.Operation;
@@ -37,8 +38,11 @@ public class VerificationController {
     @Operation(summary = "鉴权")
     @ApiResponses(value = {
             @ApiResponse(responseCode = "web", description = "{\"success\":true,\"code\":1,\"message\":\"成功\",\"data\":{\"userName\":\"张三\",\"hasNotice\": true,\"list\":[{\"id\":1,\"name\":\"工单处理\",\"url\":\"url\",\"webIcon\":\"webIcon\",\"priority\":0},{\"id\":2,\"name\":\"工单答复\",\"url\":\"url\",\"webIcon\":\"webIcon\",\"priority\":0}]}}", content = @Content(schema = @Schema(implementation = WebVerificationVo.class))),
+            @ApiResponse(responseCode = "app", description = "{ \"success\": true, \"code\": 1, \"message\": \"成功\", \"data\": [ { \"id\": 3, \"name\": \"工单答复\", \"url\": \"/pages/index/index?type=reply&fromSystem=test&token=test_token_hebei\", \"appIcon\": \"icon3\", \"priority\": 99 }, { \"id\": 1, \"name\": \"工单处理\", \"url\": \"/pages/index/index?type=dispose&fromSystem=test&token=test_token_hebei\", \"appIcon\": \"icon1\", \"priority\": 88 }, { \"id\": 2, \"name\": \"工单查询\", \"url\": \"/pages/index/index?type=query&fromSystem=test&token=test_token_hebei\", \"appIcon\": \"icon2\", \"priority\": 77 } ] }", content = @Content(schema = @Schema(implementation = AppVerificationVo.class))),
             @ApiResponse(responseCode = "permission", description = "{\"success\":true,\"code\":1,\"message\":\"成功\",\"data\":null}"),
-            @ApiResponse(responseCode = "用户不存在", description = "{\"success\":false,\"code\":0,\"message\":\"用户不存在\",\"data\":null}", content = @Content)
+            @ApiResponse(responseCode = "用户不存在", description = "{\"success\":false,\"code\":0,\"message\":\"用户不存在\",\"data\":null}", content = @Content),
+            @ApiResponse(responseCode = "省级用户无权限提示", description = "{\"success\":true,\"code\":1,\"message\":\"用户无权限,请联系省公司管理员 18631112100\",\"data\":[]", content = @Content),
+            @ApiResponse(responseCode = "地市级用户无权限提示", description = "{\"success\":true,\"code\":1,\"message\":\"用户无权限,请联系邢台地市管理员 18631901197/18603197929/15531919972\",\"data\":[]", content = @Content)
     })
     @PostMapping("/verification")
     public R verifySystem(@Valid @RequestBody TokenVo tokenEntity, HttpSession session) {

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

@@ -297,4 +297,26 @@ public interface UserDao extends BaseMapper<User> {
      */
     @Select("select * from sqmdb_rpt.acl_user where deleted = 0 and test_user = 0 order by user_id")
     List<UserVo> baseList();
+
+    /**
+     * 查询地市管理者
+     * @param cityId 地市id
+     */
+    @Select("select\n"
+            + "    *\n"
+            + "from\n"
+            + "    sqmdb_rpt.acl_user a\n"
+            + "where\n"
+            + "    test_user = 0\n"
+            + "    and deleted = 0\n"
+            + "    and exists (\n"
+            + "    select\n"
+            + "        1\n"
+            + "    from\n"
+            + "        sqmdb_rpt.acl_user_role_city b\n"
+            + "    where\n"
+            + "        b.role_id = -1\n"
+            + "        and a.user_id = b.user_id)\n"
+            + "    and city_id = #{cityId}")
+    List<User> getManagersByCityId(@Param("cityId") Integer cityId);
 }

+ 17 - 0
src/main/java/com/nokia/service/AclService.java

@@ -32,6 +32,8 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
 import javax.servlet.http.HttpSession;
 import java.time.LocalDateTime;
@@ -41,6 +43,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Service
@@ -228,6 +231,20 @@ public class AclService {
                     t.setUrl(t.getUrl() + (t.getUrl().contains("?") ? "&" : "?")
                             + "fromSystem=" + tokenEntity.getFromSystem() + "&token=" + tokenEntity.getToken());
                 }
+                // 菜单为空提示联系管理员
+                if (CollectionUtils.isEmpty(appFunctions)) {
+                    // 省级用户提示,不想收短信手机号不正确,写死王玉龙手机号
+                    if (userEntity.getCityId() == -1) {
+                        return R.ok().data(appFunctions).message("用户无权限,请联系省公司管理员 18631112100");
+                    }
+                    // 地市级用户提示
+                    String cityName = userEntity.getCity().getAreaName().replace("市", "");
+                    // 查询地市管理员
+                    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().data(appFunctions);
             case "web":
                 List<WebFunctionSystem> functions = new ArrayList<>();

+ 1 - 1
src/main/java/com/nokia/service/NoticeService.java

@@ -25,7 +25,7 @@ public class NoticeService {
     }
 
     public List<Notice> list() {
-        Page<Notice> page = new Page<>(1, 100);
+        Page<Notice> page = new Page<>(1, 20);
         page.addOrder(OrderItem.desc("create_time"));
         Page<Notice> p = noticeDao.selectPage(page, null);
         return p.getRecords();

+ 38 - 17
src/main/resources/mapper/UserMapper.xml

@@ -47,23 +47,44 @@
     </select>
 
     <select id="getByLoginName" resultMap="UserResultMap">
-        select tmp.*, ac4.area_name, ac4.parent_id as area_parent_id
-            from ( select au.user_id, au.login_name, au.user_name, au.phone, au.email, au.province_id, au.deleted,
-                ac.area_name as province_name, au.city_id, ac2.area_name as city_name, ac2.parent_id as city_parent_id,
-                ac2.type_code, au.area_id, ar.role_id, ar.role_name, ar."system",
-                aurc.city_id as role_city_id, ac3.area_name as role_area_name
-            from
-                sqmdb_rpt.acl_user au, sqmdb_rpt.acl_role ar,
-                sqmdb_rpt.acl_user_role_city aurc, sqmdb_rpt.acl_area ac,
-                sqmdb_rpt.acl_area ac2, sqmdb_rpt.acl_area ac3
-            where
-                au.user_id = aurc.user_id and ar.role_id = aurc.role_id
-                and au.province_id = ac.area_id and au.city_id = ac2.area_id
-                and aurc.city_id = ac3.area_id ) tmp
-            left join sqmdb_rpt.acl_area ac4
-            on tmp.area_id = ac4.area_id
-        where tmp.deleted = 0
-            and tmp.login_name = #{loginName}
+select
+    au.user_id,
+    au.login_name,
+    au.user_name,
+    au.phone,
+    au.email,
+    au.province_id,
+    au.deleted,
+    ac.area_name as province_name,
+    au.city_id,
+    ac2.area_name as city_name,
+    ac2.parent_id as city_parent_id,
+    ac2.type_code,
+    au.area_id,
+    ar.role_id,
+    ar.role_name,
+    ar."system",
+    aurc.city_id as role_city_id,
+    ac3.area_name as role_area_name,
+    ac4.area_name,
+    ac4.parent_id as area_parent_id
+from
+    sqmdb_rpt.acl_user au
+left join sqmdb_rpt.acl_user_role_city aurc on
+    au.user_id = aurc.user_id
+left join sqmdb_rpt.acl_role ar on
+    ar.role_id = aurc.role_id
+left join sqmdb_rpt.acl_area ac on
+    au.province_id = ac.area_id
+left join sqmdb_rpt.acl_area ac2 on
+    au.city_id = ac2.area_id
+left join sqmdb_rpt.acl_area ac3 on
+    aurc.city_id = ac3.area_id
+left join sqmdb_rpt.acl_area ac4 on
+    au.area_id = ac4.area_id
+where
+    au.deleted = 0
+    and au.login_name = #{loginName}
     </select>
 
     <select id="getByRoleIds" resultMap="UserResultMap">