lifuquan 2 rokov pred
commit
6cde7fe2d0
92 zmenil súbory, kde vykonal 4220 pridanie a 0 odobranie
  1. 1 0
      .gitignore
  2. 54 0
      doc/开发测试文档/开发环境建设/开发环境建设.md
  3. 72 0
      doc/开发测试文档/接口开发/acl提供给volte分析T2的接口.md
  4. 78 0
      doc/开发测试文档/接口开发/acl提供给投诉分析的接口.md
  5. 59 0
      doc/开发测试文档/接口开发/acl提供给投诉大屏的接口.md
  6. 76 0
      doc/开发测试文档/接口开发/acl提供给投诉预测的接口.md
  7. 396 0
      doc/开发测试文档/接口开发/acl提供给流程的接口.md
  8. 113 0
      doc/开发测试文档/接口开发/acl提供给黑点库的接口.md
  9. 9 0
      doc/开发测试文档/接口测试/acl提供给volte分析2线的接口测试.http
  10. 38 0
      doc/开发测试文档/接口测试/接口测试文档.md
  11. BIN
      doc/部署文档/jar包/1.10/aclTousu.jar
  12. BIN
      doc/部署文档/jar包/1.11/aclTousu.jar
  13. 18 0
      doc/部署文档/jar包/1.11/application-develop.properties
  14. 19 0
      doc/部署文档/jar包/1.11/application-product.properties
  15. 19 0
      doc/部署文档/jar包/1.11/application-test.properties
  16. 11 0
      doc/部署文档/jar包/1.11/application.properties
  17. BIN
      doc/部署文档/jar包/1.9/aclTousu.jar
  18. 42 0
      doc/部署文档/正式环境/bin/application.properties
  19. 3 0
      doc/部署文档/正式环境/bin/run.sh
  20. 6 0
      doc/部署文档/正式环境/bin/stop.sh
  21. 288 0
      doc/部署文档/正式环境/正式环境测试文档.md
  22. 66 0
      doc/部署文档/正式环境/正式环境部署文档.md
  23. 42 0
      doc/部署文档/测试环境/bin/application.properties
  24. 3 0
      doc/部署文档/测试环境/bin/run.sh
  25. 5 0
      doc/部署文档/测试环境/bin/stop.sh
  26. 217 0
      doc/部署文档/测试环境/测试环境测试文档.md
  27. 14 0
      doc/部署文档/测试环境/测试环境部署文档.md
  28. 61 0
      doc/需求文档/投诉系统权限管理模块需求汇总.md
  29. BIN
      doc/需求文档/需求方给出的文档资料/3线河北公共用户管理接口字段.xlsx
  30. BIN
      doc/需求文档/需求方给出的文档资料/河北公共用户管理接口字段——补城市ID对应表.xlsx
  31. BIN
      doc/需求文档/需求方给出的文档资料/流程在线协作对接用户系统Rest接口文档.docx
  32. BIN
      doc/需求文档/需求方给出的文档资料/统一门户对接工作流Rest接口文档.docx
  33. 73 0
      pom.xml
  34. 70 0
      readme.md
  35. 12 0
      src/main/java/com/nokia/AclApplication.java
  36. 67 0
      src/main/java/com/nokia/common/R.java
  37. 14 0
      src/main/java/com/nokia/config/BeanConfig.java
  38. 31 0
      src/main/java/com/nokia/config/FillMetaObjectHandler.java
  39. 17 0
      src/main/java/com/nokia/config/RedisConfig.java
  40. 35 0
      src/main/java/com/nokia/controller/CityController.java
  41. 202 0
      src/main/java/com/nokia/controller/FlowApiController.java
  42. 81 0
      src/main/java/com/nokia/controller/RoleController.java
  43. 42 0
      src/main/java/com/nokia/controller/UserController.java
  44. 104 0
      src/main/java/com/nokia/controller/VerificationController.java
  45. 21 0
      src/main/java/com/nokia/dao/AreaDao.java
  46. 21 0
      src/main/java/com/nokia/dao/CityDao.java
  47. 19 0
      src/main/java/com/nokia/dao/RoleDao.java
  48. 108 0
      src/main/java/com/nokia/dao/UserDao.java
  49. 14 0
      src/main/java/com/nokia/dao/UserRoleCityDao.java
  50. 17 0
      src/main/java/com/nokia/dao/UserRoleDao.java
  51. 21 0
      src/main/java/com/nokia/pojo/Area.java
  52. 27 0
      src/main/java/com/nokia/pojo/City.java
  53. 15 0
      src/main/java/com/nokia/pojo/District.java
  54. 21 0
      src/main/java/com/nokia/pojo/Role.java
  55. 35 0
      src/main/java/com/nokia/pojo/User.java
  56. 24 0
      src/main/java/com/nokia/pojo/UserRole.java
  57. 18 0
      src/main/java/com/nokia/pojo/UserRoleCity.java
  58. 86 0
      src/main/java/com/nokia/service/AclService.java
  59. 15 0
      src/main/java/com/nokia/service/CityService.java
  60. 27 0
      src/main/java/com/nokia/service/DopService.java
  61. 200 0
      src/main/java/com/nokia/service/FlowService.java
  62. 30 0
      src/main/java/com/nokia/service/RoleService.java
  63. 28 0
      src/main/java/com/nokia/service/TopService.java
  64. 73 0
      src/main/java/com/nokia/service/UserService.java
  65. 41 0
      src/main/java/com/nokia/vo/DapingUserVo.java
  66. 39 0
      src/main/java/com/nokia/vo/FenxiUserVo.java
  67. 42 0
      src/main/java/com/nokia/vo/HeidiankuUserVo.java
  68. 25 0
      src/main/java/com/nokia/vo/LiuchengUserVo.java
  69. 17 0
      src/main/java/com/nokia/vo/TokenFlagVo.java
  70. 15 0
      src/main/java/com/nokia/vo/TokenVo.java
  71. 10 0
      src/main/java/com/nokia/vo/UserVo.java
  72. 17 0
      src/main/java/com/nokia/vo/VolteT2UserVo.java
  73. 31 0
      src/main/java/com/nokia/vo/YuceUserVo.java
  74. 9 0
      src/main/java/com/nokia/vo/flow/FlowOrgVo.java
  75. 28 0
      src/main/java/com/nokia/vo/flow/FlowRoleCityVo.java
  76. 11 0
      src/main/java/com/nokia/vo/flow/FlowRoleVo.java
  77. 18 0
      src/main/java/com/nokia/vo/flow/FlowUserVo.java
  78. 13 0
      src/main/java/com/nokia/vo/flow/UserTreeReq.java
  79. 18 0
      src/main/resources/application-develop.properties
  80. 19 0
      src/main/resources/application-product.properties
  81. 19 0
      src/main/resources/application-test.properties
  82. 11 0
      src/main/resources/application.properties
  83. 104 0
      src/main/resources/mapper/UserMapper.xml
  84. 20 0
      src/test/java/com/nokia/OtherTest.java
  85. 34 0
      src/test/java/com/nokia/dao/AreaDaoTest.java
  86. 28 0
      src/test/java/com/nokia/dao/RoleDaoTest.java
  87. 24 0
      src/test/java/com/nokia/dao/RoleEntityDaoTest.java
  88. 102 0
      src/test/java/com/nokia/dao/UserDaoTest.java
  89. 45 0
      src/test/java/com/nokia/dao/UserRoleCityDaoTest.java
  90. 70 0
      src/test/java/com/nokia/service/FlowServiceTest.java
  91. 28 0
      src/test/java/com/nokia/service/RoleServiceTest.java
  92. 104 0
      src/test/java/com/nokia/service/UserServiceTest.java

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+target

+ 54 - 0
doc/开发测试文档/开发环境建设/开发环境建设.md

@@ -0,0 +1,54 @@
+# 开发环境建设
+
+- docker启动数据库和redis
+
+```bash
+# 数据库
+docker run -d --restart=always --name=postgres -p 5432:5432 -e POSTGRES_PASSWORD=fantuan1985 -v /home/lfq/Documents/docker/postgresql:/var/lib/postgresql/data --privileged postgres
+
+# redis
+docker run --name=redis --restart=always -p 6379:6379 -d redis
+```
+
+- 引入数据
+
+```sql
+-- 创建模式
+create schema sqmdb_rpt;
+-- 创建acl_user表
+CREATE TABLE sqmdb_rpt.acl_user (
+	user_id serial4 NOT NULL,
+	login_name varchar NULL,
+	user_name varchar NULL,
+	phone varchar NULL,
+	email varchar NULL,
+	city_id int4 NULL,
+	area_id int4 NULL,
+	province_id int4 NULL,
+	org varchar NULL,
+	CONSTRAINT user_pk PRIMARY KEY (user_id)
+);
+-- 创建acl_user_role_city表
+CREATE TABLE sqmdb_rpt.acl_user_role_city (
+	id serial4 NOT NULL,
+	user_id int4 NOT NULL,
+	role_id int4 NOT NULL,
+	city_id int4 NOT NULL,
+	CONSTRAINT user_role_city_pk PRIMARY KEY (id)
+);
+-- 创建acl_area表
+CREATE TABLE sqmdb_rpt.acl_area (
+	area_id int4 NOT NULL,
+	area_name varchar NOT NULL,
+	area_type varchar NOT NULL,
+	type_code int4 NOT NULL,
+	parent_id int4 NULL
+);
+-- 创建acl_role表
+CREATE TABLE sqmdb_rpt.acl_role (
+	role_id serial4 NOT NULL,
+	role_name varchar NULL,
+	"system" varchar NULL,
+	CONSTRAINT role_pk PRIMARY KEY (role_id)
+)
+```

+ 72 - 0
doc/开发测试文档/接口开发/acl提供给volte分析T2的接口.md

@@ -0,0 +1,72 @@
+# acl提供给volte分析T2的接口
+
+## 鉴权接口
+
+入参说明
+token 从top系统带来的token
+fromSystem 参数是从top系统带过来的 正式访问应为 top
+system 固定为 volte_t2
+
+接口ip根据访问环境自行解决,正式环境部署在192.168.70.125
+
+- 正常用户
+
+```http
+POST http://127.0.0.1:12128/api/verification
+Content-Type: application/json
+
+{
+"token": "test_token_abc",
+"fromSystem": "test",
+"system": "volte_t2"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Thu, 01 Sep 2022 04:17:17 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "loginName": "test_abc"
+  }
+}
+
+```
+
+- 用户不存在或token失效时返回
+
+```http
+POST http://127.0.0.1:12128/api/verification
+Content-Type: application/json
+
+{
+"token": "test_token_abcdddd",
+"fromSystem": "test",
+"system": "volte_t2"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Thu, 01 Sep 2022 04:20:27 GMT
+Connection: close
+
+{
+  "success": false,
+  "code": 0,
+  "message": "用户不存在",
+  "data": {
+    "redirect": "https://133.96.90.208/login"
+  }
+}
+
+```

+ 78 - 0
doc/开发测试文档/接口开发/acl提供给投诉分析的接口.md

@@ -0,0 +1,78 @@
+# acl提供给投诉分析的接口
+
+部署环境 133.96.94.176:12128
+192.168.70.125:12128
+本地环境 127.0.0.1:12128
+
+## 鉴权接口
+
+入参说明
+token 从top系统带来的token
+fromSystem 参数是从top系统带过来的 投诉预测应为 top
+system 固定为fenxi
+
+- 开发环境
+
+```http
+POST http://127.0.0.1:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui",
+  "fromSystem": "test",
+  "system": "fenxi"
+}
+```
+
+- 正式环境
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui",
+  "fromSystem": "test",
+  "system": "fenxi"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 05:02:18 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "id": 10,
+    "account": "test_abc",
+    "name": "测试用户_全省",
+    "status": null,
+    "city": "河北省"
+  }
+}
+
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 05:02:42 GMT
+Connection: close
+
+{
+  "success": false,
+  "code": 0,
+  "message": "用户不存在",
+  "data": {
+    "redirect": "https://133.96.90.208/login"
+  }
+}
+
+```

+ 59 - 0
doc/开发测试文档/接口开发/acl提供给投诉大屏的接口.md

@@ -0,0 +1,59 @@
+# acl提供给投诉大屏的接口
+
+部署环境 133.96.94.176:12128
+本地环境 127.0.0.1:12128
+
+## 鉴权接口
+
+token  测试token test_token_*** 正式token来自入口url
+fromSystem 测试token为test 正式token是dop
+system 是固定值 daping
+
+### system 由调用接口的系统确定
+
+- 开发环境
+
+```http
+POST http://127.0.0.1:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "daping"
+}
+```
+
+- 正式环境
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "daping"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 04:45:07 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "userId": 10,
+    "userName": "测试用户_全省",
+    "province": "河北省",
+    "city": "河北省"
+  }
+}
+
+```

+ 76 - 0
doc/开发测试文档/接口开发/acl提供给投诉预测的接口.md

@@ -0,0 +1,76 @@
+# acl提供给投诉预测的接口
+
+部署环境 133.96.94.176:12128
+本地环境 127.0.0.1:12128
+
+## 鉴权接口
+
+入参说明
+token 从top系统带来的token
+fromSystem 参数是从top系统带过来的 投诉预测应为 top
+system 投诉预测固定为 yuce
+
+- 开发环境
+
+```http
+POST http://127.0.0.1:12128/api/verification
+Content-Type: application/json
+
+{
+"token": "test_token_abc",
+"fromSystem": "test",
+"system": "yuce"
+}
+```
+
+- 正式环境
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+"token": "test_token_abc",
+"fromSystem": "test",
+"system": "yuce"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 04:59:47 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "userId": 10,
+    "userName": "测试用户_全省",
+    "province": "河北省",
+    "city": -1
+  }
+}
+
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 04:49:26 GMT
+Connection: close
+
+{
+  "success": false,
+  "code": 0,
+  "message": "用户不存在",
+  "data": {
+    "redirect": "https://133.96.90.208/login"
+  }
+}
+
+```

+ 396 - 0
doc/开发测试文档/接口开发/acl提供给流程的接口.md

@@ -0,0 +1,396 @@
+# acl提供给流程的接口
+
+部署环境 133.96.94.176:12128
+本地环境 127.0.0.1:12128
+
+## 鉴权接口 -开发环境
+
+```http
+POST http://127.0.0.1:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "liucheng"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 01:57:35 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "account": "test_handan",
+    "userId": 21,
+    "userName": "测试用户_邯郸市"
+  }
+}
+```
+
+## 角色列表接口
+
+入参:
+callType  findRoleList
+userName  用户名,支持模糊搜索
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findRoleList",
+  "userName": "王"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 02:07:39 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": [
+    {
+      "roleId": 4,
+      "roleName": "分析组",
+      "cities": []
+    },
+    {
+      "roleId": 3,
+      "roleName": "管理"
+    }
+  ]
+}
+
+```
+
+## 用户列表接口
+
+入参:
+callType  findToPage
+
+```http
+POST http://127.0.0.1:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findToPage"
+}
+```
+
+## 根据登录账号获取用户
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "getByLoginId",
+  "loginId": "test_handan"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 03:39:35 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "userId": 21,
+    "loginId": "test_handan",
+    "userName": "测试用户_邯郸市",
+    "mobile": "13231899751",
+    "email": null,
+    "org": {
+      "orgId": 130400,
+      "orgName": "邯郸市"
+    },
+    "district": null
+  }
+}
+
+```
+
+## 根据用户ID获取用户接口
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "get",
+  "userId": "4"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 03:44:42 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "userId": 3,
+    "loginId": "13111111111",
+    "userName": "张三",
+    "mobile": "13111111111",
+    "email": null,
+    "org": {
+      "orgId": 130100,
+      "orgName": "石家庄市"
+    },
+    "district": null
+  }
+}
+
+```
+
+## 根据用户id获取角色id列表
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findRoleIdByUserId",
+  "userId": "4"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 03:45:44 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": [
+    3,
+    4
+  ]
+}
+
+```
+
+## 根据角色id获取用户id列表
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findUserIdByRoleId",
+  "roleId": "3"
+}
+```
+
+## 多条件搜索用户
+
+入参说明:
+callType findAuthorizedUser
+roleId 可选 为空字符串与不传这个参数相同处理
+userName 可选 为空字符串与不传这个参数相同处理  可模糊查询
+loginId  可选 为空字符串与不传这个参数相同处理
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findAuthorizedUser",
+  "roleId": "3"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 15 Jul 2022 04:02:33 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": [
+    {
+      "userId": 3,
+      "loginId": "13111111111",
+      "userName": "张三",
+      "mobile": "13111111111",
+      "email": null,
+      "org": {
+        "orgId": 130100,
+        "orgName": "石家庄市"
+      },
+      "district": null
+    },
+    {
+      "userId": 7,
+      "loginId": "13866666666",
+      "userName": "赵六宝",
+      "mobile": "13866666666",
+      "email": "6324124512@163.com",
+      "org": {
+        "orgId": -1,
+        "orgName": "河北省"
+      },
+      "district": null
+    },
+    {
+      "userId": 1,
+      "loginId": "flowSystem",
+      "userName": "系统用户",
+      "mobile": "",
+      "email": "",
+      "org": {
+        "orgId": -1,
+        "orgName": "河北省"
+      },
+      "district": null
+    },
+    {
+      "userId": 4,
+      "loginId": "test_abc",
+      "userName": "李四喜",
+      "mobile": "13444444444",
+      "email": "@163.com",
+      "org": {
+        "orgId": 130200,
+        "orgName": "唐山市"
+      },
+      "district": null
+    }
+  ]
+}
+
+```
+
+## 根据用户查找角色+城市信息
+
+```http
+POST http://127.0.0.1:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "getRoleCityByUserId",
+  "userId": "13"
+}
+```
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Fri, 22 Jul 2022 09:02:33 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": [
+    {
+      "roleId": 5,
+      "roleName": "工单处理(优化处理)",
+      "cities": [
+        130200
+      ]
+    },
+    {
+      "roleId": 12,
+      "roleName": "工单答复",
+      "cities": [
+        130200
+      ]
+    },
+    {
+      "roleId": 6,
+      "roleName": "工单处理(维护处理)",
+      "cities": [
+        130200
+      ]
+    },
+    {
+      "roleId": 13,
+      "roleName": "工单处理(处理审核)",
+      "cities": [
+        130200
+      ]
+    },
+    {
+      "roleId": 4,
+      "roleName": "工单处理(投诉分析)",
+      "cities": [
+        130200
+      ]
+    },
+    {
+      "roleId": 3,
+      "roleName": "工单查询",
+      "cities": [
+        130200
+      ]
+    },
+    {
+      "roleId": 7,
+      "roleName": "工单处理(建设处理)",
+      "cities": [
+        130200
+      ]
+    },
+    {
+      "roleId": 8,
+      "roleName": "工单处理(工单审核)",
+      "cities": [
+        130200
+      ]
+    }
+  ]
+}
+
+```
+
+## 用户树形结构接口
+
+- 开发环境
+
+```http
+POST http://127.0.0.1:12128/rest/flow/api/userTree
+Content-Type: application/json
+
+{
+  "city": 131000,
+  "role": [5],
+  "user": []
+}
+```

+ 113 - 0
doc/开发测试文档/接口开发/acl提供给黑点库的接口.md

@@ -0,0 +1,113 @@
+# acl提供给黑点库的接口
+
+部署环境 133.96.94.176:12128
+本地环境 127.0.0.1:12128
+
+## 鉴权接口
+
+token  测试token test_token_*** 正式token来自入口url
+fromSystem 测试token为test 正式token是top
+system 是固定值 heidianku
+
+- 开发环境
+
+```http
+POST http://127.0.0.1:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui",
+  "fromSystem": "test",
+  "system": "heidianku"
+}
+```
+
+- 正式环境
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "heidianku"
+}
+```
+
+- 仅包含查询权限
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Tue, 19 Jul 2022 07:48:51 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "loginName": "test_hebei",
+    "userName": "测试用户_全省",
+    "province": "河北省",
+    "city": "河北省",
+    "roles": [
+      "黑点库查询"
+    ]
+  }
+}
+
+```
+
+- 增删改查权限
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Tue, 19 Jul 2022 07:49:35 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "loginName": "test_123",
+    "userName": "李小明",
+    "province": "河北省",
+    "city": "石家庄市",
+    "roles": [
+      "黑点库管理",
+      "黑点库查询"
+    ]
+  }
+}
+
+```
+
+- 无权限
+
+```json
+HTTP/1.1 200 
+Content-Type: application/json
+Transfer-Encoding: chunked
+Date: Tue, 19 Jul 2022 07:50:24 GMT
+Connection: close
+
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "loginName": "test_handan",
+    "userName": "测试用户_邯郸市",
+    "province": "河北省",
+    "city": "邯郸市",
+    "roles": []
+  }
+}
+
+```

+ 9 - 0
doc/开发测试文档/接口测试/acl提供给volte分析2线的接口测试.http

@@ -0,0 +1,9 @@
+### acl提供给volte分析2线的鉴权接口测试
+POST http://127.0.0.1:12128/api/verification
+Content-Type: application/json
+
+{
+"token": "test_token_abcddd",
+"fromSystem": "test",
+"system": "volte_t2"
+}

+ 38 - 0
doc/开发测试文档/接口测试/接口测试文档.md

@@ -0,0 +1,38 @@
+# 接口测试文档
+
+## 20220815 新增接口 根据roleID/cityId返回用户手机号列表
+
+- 正常测试用例
+
+```http
+POST http://127.0.0.1:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 130100,
+  "roleId": 5
+}
+```
+
+- 异常测试用例1
+
+```http
+POST http://127.0.0.1:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 130100,
+  "roleId": "abc"
+}
+```
+
+- 异常测试用例2
+
+```http
+POST http://127.0.0.1:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 130100
+}
+```

BIN
doc/部署文档/jar包/1.10/aclTousu.jar


BIN
doc/部署文档/jar包/1.11/aclTousu.jar


+ 18 - 0
doc/部署文档/jar包/1.11/application-develop.properties

@@ -0,0 +1,18 @@
+# web服务端口号
+server.port=12128
+
+# log配置
+logging.level.root=info
+logging.level.com.nokia=debug
+
+# 开发环境数据库配置
+spring.datasource.driver-class-name=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/postgres
+spring.datasource.username=postgres
+spring.datasource.password=fantuan1985
+
+# 开发环境redis配置 由于测试环境redis尚不具备,暂时先用正式环境的 10 顶替一下,具备后再调整
+spring.redis.host=127.0.0.1
+spring.redis.port=6379
+spring.redis.database=0
+redis.timeoutSeconds=600

+ 19 - 0
doc/部署文档/jar包/1.11/application-product.properties

@@ -0,0 +1,19 @@
+# web服务端口号
+server.port=12128
+
+# log配置
+logging.level.root=info
+logging.level.com.nokia=debug
+
+# 正式环境数据源GP数据库配置
+spring.datasource.driver-class-name=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://192.168.70.109:5432/sqmmt
+spring.datasource.username=sqmdb
+spring.datasource.password=sqmdb_1QAZ
+
+# 正式环境Redis配置
+spring.redis.host=192.168.70.125
+spring.redis.port=6379
+spring.redis.database=0
+spring.redis.password=Richr00t
+redis.timeoutSeconds=600

+ 19 - 0
doc/部署文档/jar包/1.11/application-test.properties

@@ -0,0 +1,19 @@
+# web服务端口号
+server.port=12128
+
+# log配置
+logging.level.root=info
+logging.level.com.nokia=debug
+
+# 测试环境数据库配置
+spring.datasource.driver-class-name=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://192.168.50.5:5432/sqmmt
+spring.datasource.username=sqmdb
+spring.datasource.password=sqmdb_1QAZ
+
+# 测试环境redis配置 由于测试环境redis尚不具备,暂时先用正式环境的 10 顶替一下,具备后再调整
+spring.redis.host=192.168.70.125
+spring.redis.port=6379
+spring.redis.database=10
+spring.redis.password=Richr00t
+redis.timeoutSeconds=600

+ 11 - 0
doc/部署文档/jar包/1.11/application.properties

@@ -0,0 +1,11 @@
+# 启用的配置
+spring.profiles.active=develop
+
+top.url=http://10.17.180.3/prod-api/verifySystem
+dop.url=http://10.17.180.5:8089/prod-api/verifySystem
+top.api.fromSystem=dh
+dop.api.fromSystem=dh
+top.redirect.url=https://133.96.90.208/login
+dop.redirect.url=http://133.96.90.210:8089/login
+
+mybatis.mapper-locations=classpath*:mapper/**/**Mapper.xml

BIN
doc/部署文档/jar包/1.9/aclTousu.jar


+ 42 - 0
doc/部署文档/正式环境/bin/application.properties

@@ -0,0 +1,42 @@
+# web服务端口号
+server.port=12128
+
+# log配置
+logging.level.root=info
+logging.level.com.nokia=debug
+# logging.file.name=log/acl.log
+
+# 测试环境数据库配置
+# spring.datasource.driver-class-name=org.postgresql.Driver
+# spring.datasource.url=jdbc:postgresql://192.168.50.5:5432/sqmmt
+# spring.datasource.username=sqmdb
+# spring.datasource.password=sqmdb_1QAZ
+
+# 测试环境redis配置 由于测试环境redis尚不具备,暂时先用正式环境的 10 顶替一下,具备后再调整
+# spring.redis.host=192.168.70.125
+# spring.redis.port=6379
+# spring.redis.database=10
+# spring.redis.password=Richr00t
+# redis.timeoutSeconds=600
+
+# 正式环境数据源GP数据库配置
+spring.datasource.driver-class-name=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://192.168.70.109:5432/sqmmt
+spring.datasource.username=sqmdb
+spring.datasource.password=sqmdb_1QAZ
+
+# 正式环境Redis配置
+spring.redis.host=192.168.70.125
+spring.redis.port=6379
+spring.redis.database=0
+spring.redis.password=Richr00t
+redis.timeoutSeconds=600
+
+top.url=http://10.17.180.3/prod-api/verifySystem
+dop.url=http://10.17.180.5:8089/prod-api/verifySystem
+top.api.fromSystem=dh
+dop.api.fromSystem=dh
+top.redirect.url=https://133.96.90.208/login
+dop.redirect.url=http://133.96.90.210:8089/login
+
+mybatis.mapper-locations=classpath*:mapper/**/**Mapper.xml

+ 3 - 0
doc/部署文档/正式环境/bin/run.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+nohup java -jar /data1/acl/aclTousu.jar > /data1/acl/output.out 2>&1 &

+ 6 - 0
doc/部署文档/正式环境/bin/stop.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+for i in $(ps -ef|grep aclTousu.jar |grep -v grep|awk '{print $2}')
+do 
+kill -9 $i;
+done
+

+ 288 - 0
doc/部署文档/正式环境/正式环境测试文档.md

@@ -0,0 +1,288 @@
+# 正式环境测试文档
+
+## 接口测试
+
+### 黑点库鉴权接口
+
+- 正常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "heidianku"
+}
+```
+
+- 异常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui",
+  "fromSystem": "test",
+  "system": "heidianku"
+}
+```
+
+### 流程鉴权
+
+- 正常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui",
+  "fromSystem": "test",
+  "system": "liucheng"
+}
+```
+
+- 异常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui2",
+  "fromSystem": "test",
+  "system": "liucheng"
+}
+```
+
+### 大屏鉴权
+
+- 正常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "daping"
+}
+```
+
+- 异常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui",
+  "fromSystem": "test",
+  "system": "daping"
+}
+```
+
+### 投诉分析鉴权
+
+- 正常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui",
+  "fromSystem": "test",
+  "system": "fenxi"
+}
+```
+
+- 异常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hengshui2",
+  "fromSystem": "test",
+  "system": "fenxi"
+}
+```
+
+### 投诉预测鉴权
+
+- 正常常测试用例
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+"token": "test_token_abc",
+"fromSystem": "test",
+"system": "yuce"
+}
+```
+
+- 异常测试用例--用户存在但无相应权限返回用户不存在
+
+```http
+POST http://133.96.94.176:12128/api/verification
+Content-Type: application/json
+
+{
+"token": "test_token_hengshui",
+"fromSystem": "test",
+"system": "yuce"
+}
+```
+
+### 角色列表接口
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findRoleList",
+  "userName": "王"
+}
+```
+
+### 用户列表接口
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findToPage"
+}
+```
+
+### 根据登录账号获取用户
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "getByLoginId",
+  "loginId": "test_handan"
+}
+```
+
+### 根据用户ID获取用户接口
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "get",
+  "userId": "33"
+}
+```
+
+### 根据用户id获取角色id列表
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findRoleIdByUserId",
+  "userId": "33"
+}
+```
+
+### 根据角色id获取用户id列表
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findUserIdByRoleId",
+  "roleId": "3"
+}
+```
+
+### 多条件搜索用户
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findAuthorizedUser",
+  "userId": "33"
+}
+```
+
+- 根据用户查找角色+城市信息
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "getRoleCityByUserId",
+  "userId": "13"
+}
+```
+
+### 用户树形结构接口
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api/userTree
+Content-Type: application/json
+
+{
+  "city": 130200,
+  "role": [6],
+  "user": []
+}
+```
+
+### 根据roleID/cityId返回用户手机号列表
+
+- 正常测试用例
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 131100,
+  "roleId": 5
+}
+```
+
+- 异常测试用例1--输入错误--返回错误信息
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 131200,
+  "roleId": "abc"
+}
+```
+
+- 异常测试用例2--输入参数缺失--返回空列表
+
+```http
+POST http://133.96.94.176:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 130100
+}
+```

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

@@ -0,0 +1,66 @@
+# 正式环境部署文档
+
+## v1.10部署
+
+20220815完成部署,仅更新jar包,不需更新数据库
+
+## v1.9部署
+
+1. 老版本下线
+
+    ```sh
+    # 部署路径 192.168.70.125:/data1/acl
+    sh stop.sh
+    # 备份旧版本
+    mv aclTousu.jar aclTousu.jar.bk
+    ```
+
+2. 备份数据库文件
+
+    ```sql
+    -- 备份
+    create table sqmdb_rpt.acl_area_0805 as select *from sqmdb_rpt.acl_area;
+    create table sqmdb_rpt.acl_city_0805 as select* from sqmdb_rpt.acl_city;
+    create table sqmdb_rpt.acl_district_0805 as select *from sqmdb_rpt.acl_district;
+    create table sqmdb_rpt.acl_role_0805 as select* from sqmdb_rpt.acl_role;
+    create table sqmdb_rpt.acl_user_0805 as select *from sqmdb_rpt.acl_user;
+    create table sqmdb_rpt.acl_user_role_0805 as select* from sqmdb_rpt.acl_user_role;
+    create table sqmdb_rpt.acl_user_role_city_0805 as select * from sqmdb_rpt.acl_user_role_city;
+
+    -- 如需回退操作(将正式表命名为back结尾的,然后将备份表改为正式表名)执行如下
+    alter table sqmdb_rpt.acl_area rename to acl_area_back;
+    alter table sqmdb_rpt.acl_city rename to acl_city_back;
+    alter table sqmdb_rpt.acl_district rename to acl_district_back;
+    alter table sqmdb_rpt.acl_role rename to acl_role_back;
+    alter table sqmdb_rpt.acl_user rename to acl_user_back;
+    alter table sqmdb_rpt.acl_user_role rename to acl_user_role_back;
+    alter table sqmdb_rpt.acl_user_role_city rename to acl_user_role_city_back;
+
+    alter table sqmdb_rpt.acl_area_0805 rename to acl_area;
+    alter table sqmdb_rpt.acl_city_0805 rename to acl_city;
+    alter table sqmdb_rpt.acl_district_0805 rename to acl_district;
+    alter table sqmdb_rpt.acl_role_0805 rename to acl_role;
+    alter table sqmdb_rpt.acl_user_0805 rename to acl_user;
+    alter table sqmdb_rpt.acl_user_role_0805 rename to acl_user_role;
+    alter table sqmdb_rpt.acl_user_role_city_0805 rename to acl_user_role_city;
+    ```
+
+3. 更新数据库文件
+
+4. 上传并启动新的jar包和配置文件(注意检查配置文件环境配置)
+
+    ```sh
+    # 启动
+    sh run.sh
+    ```
+
+5. 完成测试
+
+## 入口测试
+
+[大屏界面-DCN访问](http://133.96.94.108:12011?token=test_token_abc&fromSystem=test)
+
+[中屏--河北联通智慧网络运营平台](https://133.96.90.208/index)
+[大屏--网络数据运营平台](http://133.96.90.210:8089/login)
+
+wangyl5740 / Yunwang@2022

+ 42 - 0
doc/部署文档/测试环境/bin/application.properties

@@ -0,0 +1,42 @@
+# web服务端口号
+server.port=12128
+
+# log配置
+logging.level.root=info
+logging.level.com.nokia=debug
+# logging.file.name=log/acl.log
+
+# 测试环境数据库配置
+# spring.datasource.driver-class-name=org.postgresql.Driver
+# spring.datasource.url=jdbc:postgresql://192.168.50.5:5432/sqmmt
+# spring.datasource.username=sqmdb
+# spring.datasource.password=sqmdb_1QAZ
+
+# 测试环境redis配置 由于测试环境redis尚不具备,暂时先用正式环境的 10 顶替一下,具备后再调整
+# spring.redis.host=192.168.70.125
+# spring.redis.port=6379
+# spring.redis.database=10
+# spring.redis.password=Richr00t
+# redis.timeoutSeconds=600
+
+# 正式环境数据源GP数据库配置
+spring.datasource.driver-class-name=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://192.168.70.109:5432/sqmmt
+spring.datasource.username=sqmdb
+spring.datasource.password=sqmdb_1QAZ
+
+# 正式环境Redis配置
+spring.redis.host=192.168.70.125
+spring.redis.port=6379
+spring.redis.database=0
+spring.redis.password=Richr00t
+redis.timeoutSeconds=600
+
+top.url=http://10.17.180.3/prod-api/verifySystem
+dop.url=http://10.17.180.5:8089/prod-api/verifySystem
+top.api.fromSystem=dh
+dop.api.fromSystem=dh
+top.redirect.url=https://133.96.90.208/login
+dop.redirect.url=http://133.96.90.210:8089/login
+
+mybatis.mapper-locations=classpath*:mapper/**/**Mapper.xml

+ 3 - 0
doc/部署文档/测试环境/bin/run.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+nohup java -jar /data1/acl/aclTousu.jar > /data1/acl/output.out 2>&1 &

+ 5 - 0
doc/部署文档/测试环境/bin/stop.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+for i in $(ps -ef|grep aclTousu.jar |grep -v grep|awk '{print $2}')
+do 
+kill -9 $i;
+done

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

@@ -0,0 +1,217 @@
+# 测试环境测试文档
+
+## 接口测试
+
+### 根据roleID/cityId返回用户手机号列表
+
+- 正常测试用例
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 131100,
+  "roleId": 5
+}
+```
+
+- 异常测试用例1
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 131200,
+  "roleId": "abc"
+}
+```
+
+- 异常测试用例2
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api/getPhoneListByRole
+Content-Type: application/json
+
+{
+  "cityId": 130100
+}
+```
+
+### 鉴权接口
+
+- 黑点库
+
+```http
+POST http://192.168.50.3:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_hebei",
+  "fromSystem": "test",
+  "system": "heidianku"
+}
+```
+
+- 流程
+
+```http
+POST http://192.168.50.3:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "liucheng"
+}
+```
+
+- 大屏
+
+```http
+POST http://192.168.50.3:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "daping"
+}
+```
+
+- 投诉分析
+
+```http
+POST http://192.168.50.3:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "test_token_abc",
+  "fromSystem": "test",
+  "system": "fenxi"
+}
+```
+
+- 投诉预测
+
+```http
+POST http://192.168.50.3:12128/api/verification
+Content-Type: application/json
+
+{
+"token": "test_token_abc",
+"fromSystem": "test",
+"system": "yuce"
+}
+```
+
+### 提供给流程系统的接口
+
+- 角色列表接口
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findRoleList",
+  "userName": "王"
+}
+```
+
+- 用户列表接口
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findToPage"
+}
+```
+
+- 根据登录账号获取用户
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "getByLoginId",
+  "loginId": "test_handan"
+}
+```
+
+- 根据用户ID获取用户接口
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "get",
+  "userId": "4"
+}
+```
+
+- 根据用户id获取角色id列表
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findRoleIdByUserId",
+  "userId": "4"
+}
+```
+
+- 根据角色id获取用户id列表
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findUserIdByRoleId",
+  "roleId": "3"
+}
+```
+
+- 多条件搜索用户
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "findAuthorizedUser",
+  "roleId": "3"
+}
+```
+
+- 根据用户查找角色+城市信息
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api
+Content-Type: application/json
+
+{
+  "callType": "getRoleCityByUserId",
+  "userId": "4"
+}
+```
+
+### 用户树形结构接口
+
+```http
+POST http://192.168.50.3:12128/rest/flow/api/userTree
+Content-Type: application/json
+
+{
+  "city": 130200,
+  "role": [4],
+  "user": []
+}
+```

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

@@ -0,0 +1,14 @@
+# 测试环境部署文档
+
+## 部署记录
+
+20220815 部署1.10版本
+
+## 部署信息
+
+bin 部署位置 192.168.50.3:/data1/acl/
+
+```sh
+#  放开端口访问
+sudo iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 12128 -j ACCEPT
+```

+ 61 - 0
doc/需求文档/投诉系统权限管理模块需求汇总.md

@@ -0,0 +1,61 @@
+# 投诉系统权限管理模块需求汇总
+
+## 未完成需求
+
+1. Top用户数据入库(数据文件已开始推送,每天推送至192.168.70.130/data1/esbftp/top_user)
+2. 投诉系统权限管理模块UI开发,前端及交互需求由赖永俊设计,前端计划王汝岚开发,后端相关接口开发。最终部署采用前后端分离方式部署,并需要在top添加对应入口。
+
+   需求2需要用到需求1相关内容
+3. 代码优化/log优化/监控优化
+
+## 20220901新增需求--volte分析2线集成到top需要添加鉴权--1.11版本
+
+入参--正式接入top时token由top给出,fromSystem应为top
+
+```json
+{
+"token": "test_token_abc",
+"fromSystem": "test",
+"system": "volte_t2"
+}
+```
+
+出参
+
+```json
+{
+  "success": true,
+  "code": 1,
+  "message": "成功",
+  "data": {
+    "loginName": "test_abc"
+  }
+}
+```
+
+## 20220815新增需求--投诉流程系统--工单答复--1.10版本已完成
+
+工单答复需要根据地市及角色id获取人员的电话号码,地市匹配应该与role对应的权限地市匹配
+
+接口入参
+
+```json
+{
+    "roleId": 13,
+    "cityId": -1
+}
+```
+
+接口出参
+
+```json
+{
+    ["13112345678", "13212345678"]
+}
+```
+
+## 截至到20220808已完成的需求
+
+1. 给各系统模块提供的鉴权接口--当前包含的模块有 投诉流程、投诉分析、投诉大屏、投诉预测、黑点库
+2. 给投诉流程系统提供的若干接口
+3. 与top对接

BIN
doc/需求文档/需求方给出的文档资料/3线河北公共用户管理接口字段.xlsx


BIN
doc/需求文档/需求方给出的文档资料/河北公共用户管理接口字段——补城市ID对应表.xlsx


BIN
doc/需求文档/需求方给出的文档资料/流程在线协作对接用户系统Rest接口文档.docx


BIN
doc/需求文档/需求方给出的文档资料/统一门户对接工作流Rest接口文档.docx


+ 73 - 0
pom.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.nokia</groupId>
+    <artifactId>acl_tousu</artifactId>
+    <version>1.11</version>
+
+    <parent>
+        <groupId>com.nokia</groupId>
+        <artifactId>hb_springboot_parent</artifactId>
+        <version>1.0</version>
+        <relativePath />
+    </parent>
+
+    <properties>
+        <skipTests>true</skipTests>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <finalName>aclTousu</finalName>
+        <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
+        <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
+        <outputDirectory>${project.basedir}/target/classes</outputDirectory>
+        <testOutputDirectory>${project.basedir}/target/test-classes</testOutputDirectory>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 70 - 0
readme.md

@@ -0,0 +1,70 @@
+# 用户管理
+
+- 下次更新记得在给每个接口添加log
+
+## 20220805 v1.9 上线
+
+## 20220722 更新了提供给流程的接口,添加了提供给黑点库的接口 v1.8
+
+## 20220715 更新了acl提供给流程的接口 v1.6
+
+- 1.6.1 FlowUserVo 的属性 district 调整为 area 同时调整 UserDao 相关的sql语句
+
+## 项目部署信息
+
+192.168.70.125 12128端口
+/data1/acl 目录
+
+## 20220525 v1.4修改记录
+
+1. 调整验证异常接口,token为失效token时返回登陆地址
+
+```http request
+###  system 由调用接口的系统确定
+POST http://192.168.70.125:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "这是一个不存在或者无效的token",
+  "fromSystem": "dop",
+  "system": "daping"
+}
+```
+
+```json
+{
+  "success": false,
+  "code": 0,
+  "message": "用户不存在",
+  "data": {
+    "redirect": "http://133.96.90.210:8089/login"
+  }
+}
+```
+
+2. 应对token和fromSystem均为空的情况
+
+```http request
+###  system 由调用接口的系统确定
+POST http://192.168.70.125:12128/api/verification
+Content-Type: application/json
+
+{
+  "token": "",
+  "fromSystem": "",
+  "system": "daping"
+}
+```
+
+```json
+{
+  "success": false,
+  "code": 0,
+  "message": "用户不存在",
+  "data": {
+    "redirect": "http://133.96.90.210:8089/login"
+  }
+}
+```
+
+## 1.0版本 20220513上线

+ 12 - 0
src/main/java/com/nokia/AclApplication.java

@@ -0,0 +1,12 @@
+package com.nokia;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+/*@MapperScan("com.nokia.dao")*/
+public class AclApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(AclApplication.class, args);
+    }
+}

+ 67 - 0
src/main/java/com/nokia/common/R.java

@@ -0,0 +1,67 @@
+package com.nokia.common;
+
+import lombok.Data;
+
+/**
+ * 返回值的统一包装
+ */
+@Data
+public class R {
+    private Boolean success;
+    private Integer code;
+    private String message;
+
+    private Object data = null;
+
+    /**
+     * 私有化构造方法,不允许在外部实例化
+     */
+    private R() {
+    }
+
+    /**
+     * 成功的静态方法
+     *
+     * @return R实例
+     */
+    public static R ok() {
+        R r = new R();
+        r.setSuccess(true);
+        r.setCode(1);
+        r.setMessage("成功");
+        return r;
+    }
+
+    /**
+     * 失败的静态方法
+     *
+     * @return R实例
+     */
+    public static R error() {
+        R r = new R();
+        r.setSuccess(false);
+        r.setCode(0);
+        r.setMessage("失败");
+        return r;
+    }
+    public R success(Boolean success) {
+        this.setSuccess(success);
+        return this;
+    }
+
+
+    public R code(Integer code) {
+        this.setCode(code);
+        return this;
+    }
+
+    public R data(Object object) {
+        this.setData(object);
+        return this;
+    }
+
+    public R message(String message) {
+        this.setMessage(message);
+        return this;
+    }
+}

+ 14 - 0
src/main/java/com/nokia/config/BeanConfig.java

@@ -0,0 +1,14 @@
+package com.nokia.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class BeanConfig {
+    @Bean
+    public ObjectMapper objectMapper(){
+        return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+    }
+}

+ 31 - 0
src/main/java/com/nokia/config/FillMetaObjectHandler.java

@@ -0,0 +1,31 @@
+package com.nokia.config;
+
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
+import org.apache.ibatis.reflection.MetaObject;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+/**
+ * myBatisPlus的自动填充功能实现
+ *
+ * @TableField(fill = FieldFill.INSERT)
+ * private Date createTime;
+ * @TableField(fill = FieldFill.INSERT_UPDATE)
+ * private Date updateTime;
+ */
+
+@Component
+public class FillMetaObjectHandler implements MetaObjectHandler {
+    @Override
+    public void insertFill(MetaObject metaObject) {
+        Date now = new Date();
+        this.fillStrategy(metaObject, "createTime", now);
+        this.fillStrategy(metaObject, "updateTime", now);
+    }
+
+    @Override
+    public void updateFill(MetaObject metaObject) {
+        this.fillStrategy(metaObject, "updateTime", new Date());
+    }
+}

+ 17 - 0
src/main/java/com/nokia/config/RedisConfig.java

@@ -0,0 +1,17 @@
+package com.nokia.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+
+@Configuration
+public class RedisConfig {
+
+    @Bean
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
+        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
+        redisTemplate.setConnectionFactory(redisConnectionFactory);
+        return redisTemplate;
+    }
+}

+ 35 - 0
src/main/java/com/nokia/controller/CityController.java

@@ -0,0 +1,35 @@
+package com.nokia.controller;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.nokia.common.R;
+import com.nokia.pojo.City;
+import com.nokia.service.CityService;
+
+/*
+ * 已弃用代码
+ */
+@Deprecated
+@RestController
+@RequestMapping("rest/api/city")
+public class CityController {
+
+    private final CityService cityServiceimpl;
+
+    @Autowired
+    public CityController(CityService cityServiceimpl) {
+        this.cityServiceimpl = cityServiceimpl;
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    public R list() {
+        List<City> cities = cityServiceimpl.list();
+        return R.ok().data(cities);
+    }
+}

+ 202 - 0
src/main/java/com/nokia/controller/FlowApiController.java

@@ -0,0 +1,202 @@
+package com.nokia.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.nokia.common.R;
+import com.nokia.pojo.Role;
+import com.nokia.service.FlowService;
+import com.nokia.vo.flow.FlowRoleCityVo;
+import com.nokia.vo.flow.FlowRoleVo;
+import com.nokia.vo.flow.FlowUserVo;
+import com.nokia.vo.flow.UserTreeReq;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 提供给工作流的api
+ */
+@Slf4j
+@RestController
+@RequestMapping("rest")
+public class FlowApiController {
+
+    private final FlowService flowService;
+
+    @Autowired
+    public FlowApiController(FlowService flowService) {
+        this.flowService = flowService;
+    }
+
+    /*
+     * 页面上的用户树结构
+     */
+    @PostMapping("flow/api/userTree")
+    public R getUserTree(@RequestBody UserTreeReq userTreeReq) {
+        log.debug("接收到入参...{}", userTreeReq);
+        List<Map<String, Object>> userTree = flowService.getUserTree(userTreeReq);
+        log.debug("返回结果...{}", userTree);
+        return R.ok().data(userTree);
+    }
+
+    /*
+     * 根据输入的角色和city信息返回用户手机号列表
+     */
+    @PostMapping("flow/api/getPhoneListByRole")
+    public R getPhoneListByRole(@RequestBody JSONObject req) {
+        log.debug("接收到入参...{}", req);
+        try {
+            int roleId = req.getIntValue("roleId");
+            int cityId = req.getIntValue("cityId");
+            List<String> phoneList = flowService.getPhoneListByRole(roleId, cityId);
+            log.debug("返回结果...{}", phoneList);
+            return R.ok().data(phoneList);
+        } catch (NumberFormatException e) {
+            e.printStackTrace();
+            return R.error().message("roleId和cityId必需为有意义的整数");
+        }
+    }
+
+    @PostMapping("flow/api")
+    @ResponseBody
+    public R flowApi(@RequestBody JSONObject jsonObject) {
+        log.debug("接收到入参...{}", jsonObject);
+        String callType = jsonObject.getString("callType");
+        if (callType == null) {
+            return R.error().message("输入必须包含callType");
+        }
+        switch (callType) {
+            case "findRoleList":
+                return findRoleList(jsonObject);
+            case "findToPage":
+                return findToPage();
+            case "getByLoginId":
+                return getByLoginId(jsonObject);
+            case "get":
+                return get(jsonObject);
+            case "findRoleIdByUserId":
+                return findRoleIdByUserId(jsonObject);
+            case "findUserIdByRoleId":
+                return findUserIdByRoleId(jsonObject);
+            case "findAuthorizedUser":
+                return findAuthorizedUser(jsonObject);
+            case "getRoleCityByUserId":
+                return getRoleCityByUserId(jsonObject);
+            default:
+                return R.error().message("callType类型错误");
+        }
+    }
+
+    /**
+     * 
+     * @param jsonObject
+     * @return
+     */
+    private R getRoleCityByUserId(JSONObject jsonObject) {
+        Integer userId = jsonObject.getInteger("userId");
+        if (null == userId) {
+            return R.error().message("输入必须包含userId");
+        }
+        List<FlowRoleCityVo> flowRoleCityVos = new ArrayList<>();
+        for (Role role : flowService.getRoleCityByUserId(userId)) {
+            log.debug("查询结果:{}", role);
+            if ("flow".equals(role.getSystem())) {
+                flowRoleCityVos.add(new FlowRoleCityVo(role));
+            }
+        }
+        log.debug("返回结果...{}", flowRoleCityVos);
+        return R.ok().data(flowRoleCityVos);
+    }
+
+    public R findRoleList(JSONObject jsonObject) {
+        String username = jsonObject.getString("userName");
+        if (username == null || username.equals("")) {
+            return R.ok().data(flowService.findRoleList());
+        }
+        List<FlowRoleVo> roleList = flowService.findRoleList(username);
+        log.debug("返回结果...{}", roleList);
+        return R.ok().data(roleList);
+    }
+
+    public R findToPage() {
+        List<FlowUserVo> flowUserVos = flowService.findToPage();
+        log.debug("返回结果...{}", flowUserVos);
+        return R.ok().data(flowUserVos);
+    }
+
+    public R getByLoginId(JSONObject jsonObject) {
+        String loginId = jsonObject.getString("loginId");
+        if (loginId == null || loginId.equals("")) {
+            return R.error().message("输入必须包含loginId");
+        }
+        FlowUserVo flowUserVo = flowService.getByLoginId(loginId);
+        log.debug("返回结果...{}", flowUserVo);
+        return R.ok().data(flowUserVo);
+    }
+
+    public R get(JSONObject jsonObject) {
+        Integer userId = null;
+        try {
+            userId = jsonObject.getInteger("userId");
+        } catch (NumberFormatException e) {
+            return R.error().message("输入的userId必须为整数格式");
+        }
+        if (userId == null) {
+            return R.error().message("输入必须包含userId");
+        }
+        FlowUserVo flowUserVo = flowService.getByUserId(userId);
+        log.debug("返回结果...{}", flowUserVo);
+        return R.ok().data(flowUserVo);
+    }
+
+    public R findRoleIdByUserId(JSONObject jsonObject) {
+        Integer userId = null;
+        try {
+            userId = jsonObject.getInteger("userId");
+        } catch (NumberFormatException e) {
+            return R.error().message("输入的userId必须为整数格式");
+        }
+        if (userId == null) {
+            return R.error().message("输入必须包含userId");
+        }
+        List<Integer> roleIdList = flowService.findRoleIdByUserId(userId);
+        log.debug("返回结果...{}", roleIdList);
+        return R.ok().data(roleIdList);
+    }
+
+    public R findUserIdByRoleId(JSONObject jsonObject) {
+        Integer roleId = null;
+        try {
+            roleId = jsonObject.getInteger("roleId");
+        } catch (NumberFormatException e) {
+            return R.error().message("输入的roleId必须为整数格式");
+        }
+        if (roleId == null) {
+            return R.error().message("输入必须包含roleId");
+        }
+        List<Integer> userIdList = flowService.findUserIdByRoleId(roleId);
+        log.debug("返回结果...{}", userIdList);
+        return R.ok().data(userIdList);
+    }
+
+    public R findAuthorizedUser(JSONObject jsonObject) {
+        String loginId = jsonObject.getString("loginId");
+        loginId = loginId == null || loginId.equals("") ? null : loginId.trim();
+        Integer roleId = null;
+        try {
+            roleId = jsonObject.getInteger("roleId");
+        } catch (NumberFormatException ignored) {
+        }
+        String userName = jsonObject.getString("userName");
+        userName = userName == null || userName.equals("") ? null : userName.trim();
+        List<FlowUserVo> flowUserVos = flowService.findAuthorizedUser(loginId, roleId, userName);
+        log.debug("返回结果...{}", flowUserVos);
+        return R.ok().data(flowUserVos);
+    }
+
+}

+ 81 - 0
src/main/java/com/nokia/controller/RoleController.java

@@ -0,0 +1,81 @@
+package com.nokia.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.nokia.common.R;
+import com.nokia.dao.RoleDao;
+import com.nokia.pojo.Role;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RequestMapping("rest/api/role")
+@RestController
+public class RoleController {
+
+    public final RoleDao roleDao;
+
+    @Autowired
+    public RoleController(RoleDao roleDao){
+        this.roleDao=roleDao;
+    }
+
+    @PostMapping("/list")
+    public R list() {
+        return R.ok().data(roleDao.selectList(null));
+    }
+
+    @PostMapping("/add")
+    public R RoleAdd(@RequestBody Role roleEntity){
+        if (roleEntity==null){
+            return R.error().message("空");
+        }
+        QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("role_name",roleEntity.getRoleName());
+        Role roleEntity1 = roleDao.selectOne(queryWrapper);
+        if (roleEntity1!=null){
+            return R.error().message("角色已经存在");
+        }
+        int insert = roleDao.insert(roleEntity);
+        if (insert>0){
+            return R.ok().message("添加成功");
+        }else {
+            return R.error().message("添加失败");
+        }
+    }
+
+    @PostMapping("/delete/id/{roleId}")
+    public R RoleDelete(@PathVariable Integer roleId){
+        if (roleId==null){
+            return R.error().message("roleId 为空");
+        }
+        int ResurnRole = roleDao.deleteById(roleId);
+        if (ResurnRole>0){
+            return R.ok().message("删除成功");
+        }else {
+            return R.error().message("删除失败");
+        }
+    }
+
+    @PostMapping("/update/id/{roleId}")
+    public R RoleUpdate(@PathVariable Integer roleId, @RequestBody Role roleEntity){
+        if (roleEntity==null){
+            return R.error().message("roleEntity 为空");
+        }
+        Role roleEntity1 = roleDao.selectById(roleId);
+        roleEntity1.setRoleName(roleEntity.getRoleName());
+        int i = roleDao.updateById(roleEntity1);
+        if (i>0){
+            return R.ok().message("修改成功");
+        }else {
+            return R.ok().message("修改失败");
+        }
+    }
+
+    @PostMapping("/select/id/{roleId}")
+    public R RoleSelect(@PathVariable Integer roleId){
+        if (roleId==null){
+            return R.error().message("roleId 为空");
+        }
+        Role roleEntity = roleDao.selectById(roleId);
+        return  roleEntity==null ? R.error().message("role不存在") :R.ok().data(roleEntity);
+    }
+}

+ 42 - 0
src/main/java/com/nokia/controller/UserController.java

@@ -0,0 +1,42 @@
+package com.nokia.controller;
+
+import com.nokia.common.R;
+import com.nokia.pojo.User;
+import com.nokia.service.UserService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("rest/api/user")
+public class UserController {
+    private final UserService userServiceImpl;
+
+    @Autowired
+    public UserController(UserService userServiceImpl) {
+        this.userServiceImpl = userServiceImpl;
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    public R list() {
+        List<User> userEntities = userServiceImpl.list();
+        return R.ok().data(userEntities);
+    }
+
+    @PostMapping("add")
+    @ResponseBody
+    public R add(@RequestBody User user) {
+        if (user.getLoginName() == null || user.getLoginName().equals("")) {
+            return R.error().message("LoginName不能为空");
+        }
+        String msg = userServiceImpl.add(user);
+        if (msg.equals("ok")) {
+            return R.ok().message("添加成功");
+        } else {
+            return R.error().message(msg);
+        }
+    }
+}

+ 104 - 0
src/main/java/com/nokia/controller/VerificationController.java

@@ -0,0 +1,104 @@
+package com.nokia.controller;
+
+import com.nokia.common.R;
+import com.nokia.pojo.User;
+import com.nokia.service.AclService;
+import com.nokia.vo.DapingUserVo;
+import com.nokia.vo.FenxiUserVo;
+import com.nokia.vo.LiuchengUserVo;
+import com.nokia.vo.TokenVo;
+import com.nokia.vo.VolteT2UserVo;
+import com.nokia.vo.YuceUserVo;
+import com.nokia.vo.HeidiankuUserVo;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@RestController
+@RequestMapping("/api")
+public class VerificationController {
+
+    @Autowired
+    private AclService aclService;
+
+    /*
+     * 重定向的url,解决当token失效时的重定向问题
+     */
+    @Value("${dop.redirect.url}")
+    private String dopRedirectUrl;
+    @Value("${top.redirect.url}")
+    private String topRedirectUrl;
+
+    @PostMapping("/verification")
+    public R verifySystem(@RequestBody TokenVo tokenEntity) {
+        log.debug("输入参数: {}", tokenEntity);
+        User userEntity = aclService.verifySystem(tokenEntity.getToken(), tokenEntity.getFromSystem());
+        log.debug("输出用户信息: {}", userEntity);
+        Map<String, String> map = new HashMap<>();
+        if (tokenEntity.getFromSystem().equalsIgnoreCase("top")) {
+            map.put("redirect", topRedirectUrl);
+        } else if (tokenEntity.getFromSystem().equalsIgnoreCase("dop")) {
+            map.put("redirect", dopRedirectUrl);
+        } else {
+            // 根据接入的系统不同,返回不同的重定向url
+            switch (tokenEntity.getSystem().trim().toLowerCase()) {
+                case "daping":
+                    map.put("redirect", dopRedirectUrl);
+                    break;
+                // case "liucheng":
+                // case "fenxi":
+                // case "yuce":
+                // case "heidianku":
+                default:
+                    map.put("redirect", topRedirectUrl);
+                    break;
+            }
+        }
+        if (userEntity == null) {
+            return R.error().data(map).message("用户不存在");
+        } else {
+            switch (tokenEntity.getSystem().trim().toLowerCase()) {
+                case "liucheng":
+                    return R.ok().data(new LiuchengUserVo(userEntity));
+                case "fenxi":
+                    FenxiUserVo fenxiUserVo = new FenxiUserVo(userEntity);
+                    if (fenxiUserVo.getCity() == null) {
+                        return R.error().data(map).message("用户不存在");
+                    }
+                    return R.ok().data(fenxiUserVo);
+                case "daping":
+                    DapingUserVo dapingUserVo = new DapingUserVo(userEntity);
+                    if (dapingUserVo.getCity() == null) {
+                        return R.error().data(map).message("用户不存在");
+                    }
+                    return R.ok().data(dapingUserVo);
+                case "yuce":
+                    YuceUserVo yuceUserVo = new YuceUserVo(userEntity);
+                    if (yuceUserVo.getCity() == null) {
+                        return R.error().data(map).message("用户不存在");
+                    }
+                    return R.ok().data(yuceUserVo);
+                case "heidianku": // 黑点库
+                    HeidiankuUserVo heidiankuUserVo = new HeidiankuUserVo(userEntity);
+                    if (heidiankuUserVo.getCity() == null) {
+                        return R.error().data(map).message("用户不存在");
+                    }
+                    return R.ok().data(heidiankuUserVo);
+                case "volte_t2": // volte分析T2页面
+                    VolteT2UserVo userVo = new VolteT2UserVo(userEntity);
+                    return R.ok().data(userVo);
+                default:
+                    return R.error().message("当前允许的system为: liucheng/fenxi/daping/yuce/heidianku/volte_t2");
+            }
+        }
+    }
+}

+ 21 - 0
src/main/java/com/nokia/dao/AreaDao.java

@@ -0,0 +1,21 @@
+package com.nokia.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import com.nokia.pojo.Area;
+
+@Mapper
+public interface AreaDao {
+
+    @Select("select * from sqmdb_rpt.acl_area order by type_code, area_id")
+    List<Area> getAll();
+
+    @Select("select * from sqmdb_rpt.acl_area where parent_id = #{parentId} order by type_code, area_id")
+    List<Area> getByParentId(int parent_id);
+
+    @Select("select * from sqmdb_rpt.acl_area where area_id = #{areaId}")
+    Area getByAreaId(int areaId);
+}

+ 21 - 0
src/main/java/com/nokia/dao/CityDao.java

@@ -0,0 +1,21 @@
+package com.nokia.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.nokia.pojo.City;
+import com.nokia.vo.flow.FlowOrgVo;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+/*
+ * 已弃用代码
+ */
+@Deprecated
+@Mapper
+public interface CityDao extends BaseMapper<City> {
+    @Select("select * from sqmdb_rpt.acl_city where city_id = #{cityId}")
+    City findByCityId(Integer cityId);
+
+    @Select("select city_id as org_id, city_name_zh as org_name from sqmdb_rpt.acl_city where city_id = #{cityId}")
+    FlowOrgVo findOrgByCityId(Integer cityId);
+}

+ 19 - 0
src/main/java/com/nokia/dao/RoleDao.java

@@ -0,0 +1,19 @@
+package com.nokia.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.nokia.pojo.Role;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface RoleDao extends BaseMapper<Role> {
+
+    @Select("select r.role_id, r.role_name, r.system from sqmdb_rpt.acl_role r, sqmdb_rpt.acl_user_role ur where r.role_id = ur.role_id and ur.user_id = #{userId}")
+    List<Role> findByUserId(Integer userId);
+
+    @Select("select * from sqmdb_rpt.acl_role where role_name like concat('%',#{roleName},'%')")
+    List<Role> findRoleNameLike(String roleName);
+}

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

@@ -0,0 +1,108 @@
+package com.nokia.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.nokia.pojo.Role;
+import com.nokia.pojo.User;
+import com.nokia.vo.flow.FlowRoleVo;
+import com.nokia.vo.flow.FlowUserVo;
+
+import org.apache.ibatis.annotations.*;
+import java.util.List;
+
+@Mapper
+public interface UserDao extends BaseMapper<User> {
+
+        /**
+         * 支持username模糊查询
+         */
+        @Select("select distinct r.role_id, r.role_name from sqmdb_rpt.acl_user u, sqmdb_rpt.acl_role r, sqmdb_rpt.acl_user_role_city ur"
+                        + " where u.user_id = ur.user_id and r.role_id = ur.role_id and r.system='flow' and u.user_name like concat('%',#{username},'%')")
+        List<FlowRoleVo> findRoleList(String username);
+
+        /**
+         * 查询全部
+         */
+        @Select("select role_id, role_name from sqmdb_rpt.acl_role where system = 'flow'")
+        List<FlowRoleVo> findRoleList2();
+
+        /**
+         * 查询全部用户(流程所需),未分页
+         */
+        @Results({
+                        @Result(column = "org_id", property = "org.orgId"),
+                        @Result(column = "org_name", property = "org.orgName"),
+        })
+        @Select("select a.user_id as user_id, a.login_name as login_id, a.user_name as user_name, a.phone as mobile, a.email as email,"
+                        + " a.city_id as org_id, c1.area_name as org_name, a.area_id as area"
+                        + " from sqmdb_rpt.acl_user a, sqmdb_rpt.acl_area c1"
+                        + " where a.city_id = c1.area_id")
+        List<FlowUserVo> findToPage();
+
+        /**
+         * 查询登录用户信息
+         */
+        @Results({
+                        @Result(column = "org_id", property = "org.orgId"),
+                        @Result(column = "org_name", property = "org.orgName"),
+        })
+        @Select("select a.user_id as user_id, a.login_name as login_id, a.user_name as user_name, a.phone as mobile, a.email as email,"
+                        + " a.city_id as org_id, c.area_name as org_name, a.area_id as area"
+                        + " from sqmdb_rpt.acl_user a, sqmdb_rpt.acl_area c"
+                        + " where a.city_id = c.area_id and a.login_name=#{loginId}")
+        FlowUserVo getFlowUserVoByLoginId(String loginId);
+
+        /**
+         * 根据用户ID获取用户接口
+         */
+        @Results({
+                        @Result(column = "org_id", property = "org.orgId"),
+                        @Result(column = "org_name", property = "org.orgName"),
+        })
+        @Select("select a.user_id as user_id, a.login_name as login_id, a.user_name as user_name, a.phone as mobile, a.email as email,"
+                        + " a.city_id as org_id, c.area_name as org_name, a.area_id as area"
+                        + " from sqmdb_rpt.acl_user a, sqmdb_rpt.acl_area c"
+                        + " where a.city_id = c.area_id and user_id=#{userId}")
+        FlowUserVo getFlowUserVoByUserId(Integer userId);
+
+        @Select("select r.role_id from  sqmdb_rpt.acl_role r,  sqmdb_rpt.acl_user_role_city ur where r.role_id = ur.role_id and r.system='flow' and ur.user_id=#{userId}")
+        List<Integer> findRoleIdByUserId(Integer userId);
+
+        @Select("select u.user_id from sqmdb_rpt.acl_user u,  sqmdb_rpt.acl_user_role_city ur where u.user_id = ur.user_id and ur.role_id=#{roleId}")
+        List<Integer> findUserIdByRoleId(Integer roleId);
+
+        @Results({
+                        @Result(column = "org_id", property = "org.orgId"),
+                        @Result(column = "org_name", property = "org.orgName"),
+        })
+        @Select("<script>"
+                        + "select a.user_id as user_id, a.login_name as login_id, a.user_name as user_name, a.phone as mobile, a.email as email,"
+                        + " a.city_id as org_id, c.area_name as org_name, a.area_id as area"
+                        + " from sqmdb_rpt.acl_user a, sqmdb_rpt.acl_area c, sqmdb_rpt.acl_user_role_city ur "
+                        + " where a.user_id = ur.user_id and a.city_id = c.area_id"
+                        + "<if test=\"loginId != null and loginId !=''\">"
+                        + " and a.login_name=#{loginId} "
+                        + "</if>"
+                        + "<if test=\"roleId != null\">"
+                        + " and ur.role_id=#{roleId} "
+                        + "</if>"
+                        + "<if test=\"userName != null and userName !=''\">"
+                        + " and a.user_name like concat('%',#{userName},'%') "
+                        + "</if>"
+                        + "</script>")
+        List<FlowUserVo> findAuthorizedUser(String loginId, Integer roleId, String userName);
+
+        List<Role> getRoleCityByUserId(Integer userId);
+
+        User getByLoginName(String loginName);
+
+        @Select("select user_id from sqmdb_rpt.acl_user au where au.login_name = #{loginName}")
+        Integer hasLoginName(String loginName);
+
+        List<User> getByRoleIds(List<Integer> roleIds, List<Integer> cityIds);
+
+        List<String> getPhoneListByRole(Integer roleId, Integer cityId);
+
+        @Insert("INSERT INTO sqmdb_rpt.acl_user (login_name, user_name, phone, email, city_id, area_id, province_id, org) "
+                        + " VALUES(#{loginName}, #{userName}, #{phone}, #{email}, #{cityId}, #{areaId}, #{provinceId}, #{org})")
+        int insert(User user);
+}

+ 14 - 0
src/main/java/com/nokia/dao/UserRoleCityDao.java

@@ -0,0 +1,14 @@
+package com.nokia.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.nokia.pojo.UserRoleCity;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface UserRoleCityDao extends BaseMapper<UserRoleCity> {
+
+    @Select("select role_id from sqmdb_rpt.acl_user_role_city where user_id = #{userId} and role_id= #{roleId} and city_id = #{cityId}")
+    Integer hasRoleCity(Integer userId, Integer roleId, Integer cityId);
+}

+ 17 - 0
src/main/java/com/nokia/dao/UserRoleDao.java

@@ -0,0 +1,17 @@
+package com.nokia.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.nokia.pojo.UserRole;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+/*
+ * 已弃用代码
+ */
+@Deprecated
+@Mapper
+public interface UserRoleDao extends BaseMapper<UserRole> {
+
+    @Select("select role_id from sqmdb_rpt.acl_user_role where user_id = #{userId} and role_id= #{role_id}")
+    Integer hasRole(Integer userId, Integer role_id);
+}

+ 21 - 0
src/main/java/com/nokia/pojo/Area.java

@@ -0,0 +1,21 @@
+package com.nokia.pojo;
+
+import java.io.Serializable;
+
+import lombok.Data;
+
+/*
+ * 行政区划
+ */
+@Data
+public class Area implements Serializable {
+    // 每个区域会有1个唯一Id
+    private Integer areaId;
+    // 行政区中文名
+    private String areaName;
+    // 省 province 1 地市 city 2 区县 area 3
+    private String areaType;
+    private Integer typeCode;
+    // 上一级行政区的id
+    private Integer parentId;
+}

+ 27 - 0
src/main/java/com/nokia/pojo/City.java

@@ -0,0 +1,27 @@
+package com.nokia.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 城市
+ */
+@Deprecated
+@Data
+@TableName("sqmdb_rpt.acl_city")
+public class City implements Serializable {
+    @TableId(type = IdType.AUTO)
+    private Integer cityId;
+    // 城市中文名
+    private String cityNameZh;
+    // 城市英文名
+    private String cityNameEn;
+    // 排序
+    private Integer ord;
+    // 归属省中文名
+    private String province;
+}

+ 15 - 0
src/main/java/com/nokia/pojo/District.java

@@ -0,0 +1,15 @@
+package com.nokia.pojo;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import lombok.Data;
+
+@Deprecated
+@Data
+@TableName("sqmdb_rpt.acl_district")
+public class District {
+    private Integer cityId;
+    private String cityName;
+    private Integer districtId;
+    private String districtName;
+}

+ 21 - 0
src/main/java/com/nokia/pojo/Role.java

@@ -0,0 +1,21 @@
+package com.nokia.pojo;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+/**
+ * 角色类
+ */
+@Data
+@TableName("sqmdb_rpt.acl_role")
+public class Role implements Serializable {
+    @TableId(type = IdType.AUTO)
+    private Integer roleId;
+    private String roleName;
+    private String system;
+    @TableField(exist = false)
+    private List<Area> cities;
+}

+ 35 - 0
src/main/java/com/nokia/pojo/User.java

@@ -0,0 +1,35 @@
+package com.nokia.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Set;
+
+@Data
+@TableName("sqmdb_rpt.acl_user")
+public class User implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    private Integer userId;
+    private String loginName;
+    private String userName;
+    private String phone;
+    private String email;
+    private String org;
+    // 所属省
+    private Integer provinceId;
+    @TableField(exist = false)
+    private Area province;
+    // 所处地市
+    private Integer cityId;
+    @TableField(exist = false)
+    private Area city;
+    // 所属区县 为空表示不归属区县 归属于地市
+    private Integer areaId;
+    @TableField(exist = false)
+    private Area area;
+
+    @TableField(exist = false)
+    private Set<Role> roles;
+}

+ 24 - 0
src/main/java/com/nokia/pojo/UserRole.java

@@ -0,0 +1,24 @@
+package com.nokia.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.util.Date;
+
+@Deprecated
+@Data
+@TableName("sqmdb_rpt.acl_user_role")
+public class UserRole {
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+    private Integer userId;
+    private Integer roleId;
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+    @TableField(exist = false)
+    private Role roleEntity;
+    @TableField(exist = false)
+    private User userEntity;
+}

+ 18 - 0
src/main/java/com/nokia/pojo/UserRoleCity.java

@@ -0,0 +1,18 @@
+package com.nokia.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import lombok.Data;
+
+@Data
+@TableName("sqmdb_rpt.acl_user_role_city")
+public class UserRoleCity {
+
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+    private Integer userId;
+    private Integer roleId;
+    private Integer cityId;
+}

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

@@ -0,0 +1,86 @@
+package com.nokia.service;
+
+import com.nokia.dao.UserDao;
+import com.nokia.pojo.User;
+import com.nokia.vo.TokenFlagVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+@Service
+public class AclService {
+
+    @Value("${redis.timeoutSeconds:600}")
+    private Integer timeoutSeconds;
+
+    private final UserDao userDao;
+    private final TopService topService;
+    private final DopService dopService;
+
+    private final RedisTemplate<String, Object> redisTemplate;
+
+    @Autowired
+    public AclService(UserDao userDao, TopService topService, DopService dopService,
+            RedisTemplate<String, Object> redisTemplate) {
+        this.userDao = userDao;
+        this.topService = topService;
+        this.dopService = dopService;
+        this.redisTemplate = redisTemplate;
+    }
+
+    public User verifySystem(String token, String fromSystem) {
+        User userEntity = null;
+        // 从redis中查询
+        userEntity = (User) redisTemplate.opsForValue().get(token);
+        if (userEntity != null) {
+            log.debug("redis查询成功: {}", userEntity);
+            // 2.1 可以查到用户信息,重置redis中的用户信息,刷新到期时间
+            redisTemplate.opsForValue().set(token, userEntity, timeoutSeconds, TimeUnit.SECONDS);
+            // 3 返回用户信息
+            return userEntity;
+        } else {
+            // 2.2 无法查到用户信息 可能是已超timeoutSeconds或者是初次登录
+            // 需要根据fromSystem参数去对应的系统进行鉴权
+            TokenFlagVo tokenFlagVo = getVerifyResult(token, fromSystem);
+            if (tokenFlagVo != null && tokenFlagVo.isValid()) {
+                // 如果token状态为可用,根据loginName从数据库查询用户
+                // 这里存在一个问题,如果是在top已存在的用户,但是我们系统没有,此时返回的userEntity为null,会对后续处理产生影响,需要考虑应该怎么做
+                // 在前端处理,上面的问题仅影响初次点击入口的用户,不影响超时用户
+                // 前端需要对入口用户做特别的处理
+                userEntity = userDao.getByLoginName(tokenFlagVo.getLoginName());
+                if (userEntity != null) {
+                    // 仅当用户信息不为空时,将用户信息存入redis
+                    redisTemplate.opsForValue().set(token, userEntity, timeoutSeconds, TimeUnit.SECONDS);
+                }
+                // 返回用户信息
+                return userEntity;
+            } else {
+                // token无效,返回重定向的登陆地址
+                return null;
+            }
+        }
+    }
+
+    private TokenFlagVo getVerifyResult(String token, String fromSystem) {
+        if (fromSystem.trim().equalsIgnoreCase("dop")) {
+            return dopService.dopReturn(token);
+        } else if (fromSystem.trim().equalsIgnoreCase("top")) {
+            return topService.topReturn(token);
+        } else if (fromSystem.trim().equalsIgnoreCase("test")) {
+            // 测试用
+            return testToken(token);
+        }
+        return null;
+    }
+
+    private TokenFlagVo testToken(String token) {
+        String login_name = token.trim().toLowerCase();
+        login_name = login_name.replace("test_token_", "test_");
+        return new TokenFlagVo(0, login_name);
+    }
+}

+ 15 - 0
src/main/java/com/nokia/service/CityService.java

@@ -0,0 +1,15 @@
+package com.nokia.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.nokia.dao.CityDao;
+import com.nokia.pojo.City;
+import org.springframework.stereotype.Service;
+
+/*
+ * 已弃用代码
+ */
+@Deprecated
+@Service
+public class CityService extends ServiceImpl<CityDao, City> {
+
+}

+ 27 - 0
src/main/java/com/nokia/service/DopService.java

@@ -0,0 +1,27 @@
+package com.nokia.service;
+
+import com.nokia.vo.TokenFlagVo;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+
+@Service
+public class DopService{
+
+    @Value("${dop.url}")
+    private String dopUrl;
+    @Value("${dop.api.fromSystem:tousu}")
+    private String fromSystem;
+
+    public TokenFlagVo dopReturn(String token) {
+        HashMap<Object, Object> hashMap = new HashMap<>();
+        hashMap.put("token", token);
+        hashMap.put("fromSystem", fromSystem);
+        RestTemplate restTemplate = new RestTemplate();
+        TokenFlagVo tokenFlagVo = restTemplate.postForObject(dopUrl, hashMap, TokenFlagVo.class);
+        return tokenFlagVo;
+    }
+
+}

+ 200 - 0
src/main/java/com/nokia/service/FlowService.java

@@ -0,0 +1,200 @@
+package com.nokia.service;
+
+import com.nokia.dao.AreaDao;
+import com.nokia.dao.UserDao;
+import com.nokia.pojo.Area;
+import com.nokia.pojo.Role;
+import com.nokia.pojo.User;
+import com.nokia.vo.flow.FlowRoleVo;
+import com.nokia.vo.flow.FlowUserVo;
+import com.nokia.vo.flow.UserTreeReq;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+@Service
+public class FlowService {
+
+    private final UserDao userDao;
+    private final AreaDao areaDao;
+
+    @Autowired
+    public FlowService(UserDao userDao, AreaDao areaDao) {
+        this.userDao = userDao;
+        this.areaDao = areaDao;
+    }
+
+    public List<FlowRoleVo> findRoleList(String username) {
+        return userDao.findRoleList(username);
+    }
+
+    public List<FlowRoleVo> findRoleList() {
+        return userDao.findRoleList2();
+    }
+
+    public List<FlowUserVo> findToPage() {
+        return userDao.findToPage();
+    }
+
+    public FlowUserVo getByLoginId(String loginId) {
+        return userDao.getFlowUserVoByLoginId(loginId);
+    }
+
+    public FlowUserVo getByUserId(Integer userId) {
+        return userDao.getFlowUserVoByUserId(userId);
+    }
+
+    public List<Integer> findRoleIdByUserId(Integer userId) {
+        return userDao.findRoleIdByUserId(userId);
+    }
+
+    public List<Integer> findUserIdByRoleId(Integer roleId) {
+        return userDao.findUserIdByRoleId(roleId);
+    }
+
+    public List<FlowUserVo> findAuthorizedUser(String loginId, Integer roleId, String userName) {
+        return userDao.findAuthorizedUser(loginId, roleId, userName);
+    }
+
+    public List<Role> getRoleCityByUserId(Integer userId) {
+        return userDao.getRoleCityByUserId(userId);
+    }
+
+    @SuppressWarnings("unchecked")
+    public List<Map<String, Object>> getUserTree(UserTreeReq userTreeReq) {
+        // cityIds 用于查找用户 用户在叶子节点
+        List<Integer> cityIds = new ArrayList<>();
+        // areas 用于构建树结构的前两层
+        List<Area> areas = new ArrayList<>();
+        // 这里检查一下查找条件的role不为空
+        List<Integer> queryRoles = (userTreeReq.getRole() == null || userTreeReq.getRole().size() == 0) ? null
+                : userTreeReq.getRole();
+        if (userTreeReq.getCity() == -1 || queryRoles == null) {
+            // 如果这里给的是河北省 或者 role 为空,那么需要取全部
+            areas = areaDao.getAll();
+        } else {
+            // 都需要添加省级用户
+            areas.add(areaDao.getByAreaId(-1));
+            // 添加对应的地市
+            areas.add(areaDao.getByAreaId(userTreeReq.getCity()));
+            // 添加地市对应的区县
+            areas.addAll(areaDao.getByParentId(userTreeReq.getCity()));
+        }
+        // query用的cityIds
+        if (userTreeReq.getCity() == -1) {
+            // 如果这里给的是河北省,那么需要取全部
+            cityIds = null;
+        } else {
+            cityIds.add(-1);
+            cityIds.add(userTreeReq.getCity());
+        }
+        // 组织结果
+        List<Map<String, Object>> result = new ArrayList<>();
+        // 用于记录第一层排序
+        Map<Integer, Integer> top = new HashMap<>();
+        // 用于记录第二层排序
+        Map<Integer, Integer> second = new HashMap<>();
+        for (int i = 0; i < areas.size(); i++) {
+            if (areas.get(i).getTypeCode() == 1) {
+                // 省
+                // 第一层
+                Map<String, Object> map1 = new LinkedHashMap<>();
+                map1.put("name", areas.get(i).getAreaName());
+                map1.put("child", new ArrayList<>());
+                result.add(map1);
+                // 记录第一层排序
+                top.put(areas.get(i).getAreaId(), i);
+                // 第二层
+                Map<String, Object> map2 = new LinkedHashMap<>();
+                map2.put("name", "省公司");
+                map2.put("child", new ArrayList<>());
+                ((List<Object>) map1.get("child")).add(map2);
+            } else if (areas.get(i).getTypeCode() == 2) {
+                // 地市
+                // 第一层
+                Map<String, Object> map1 = new LinkedHashMap<>();
+                map1.put("name", areas.get(i).getAreaName());
+                map1.put("child", new ArrayList<>());
+                result.add(map1);
+                // 记录第一层排序
+                top.put(areas.get(i).getAreaId(), i);
+                // 第二层
+                Map<String, Object> map2 = new LinkedHashMap<>();
+                map2.put("name", "市公司");
+                map2.put("child", new ArrayList<>());
+                ((List<Object>) map1.get("child")).add(map2);
+            } else {
+                // 区县,仅第二层
+                Map<String, Object> map = new LinkedHashMap<>();
+                map.put("name", areas.get(i).getAreaName());
+                map.put("child", new ArrayList<>());
+                // 加入到第二层
+                List<Object> list = (List<Object>) result.get(top.get(areas.get(i).getParentId())).get("child");
+                list.add(map);
+                // 记录第二层排序
+                second.put(areas.get(i).getAreaId(), list.size() - 1);
+            }
+        }
+
+        // 查询符合条件的用户
+        List<User> users = userDao.getByRoleIds(queryRoles, cityIds);
+        // key 区域(市公司或区域) value 一个列表,列表内放区域内全部的用户信息
+        Map<Area, Object> userMap = new LinkedHashMap<>();
+        // 将用户归类
+        for (User user : users) {
+            Map<String, Object> map = new LinkedHashMap<>();
+            // 获取用户区县,如果区县为空则获取用户地市
+            Area area = user.getArea() == null ? user.getCity() : user.getArea();
+            map.put("name", area.getAreaName());
+            map.put("userName", user.getUserName());
+            map.put("userId", user.getUserId());
+            map.put("child", new ArrayList<>());
+            // 把 map 放入 列表中
+            List<Object> userList = ((List<Object>) userMap.getOrDefault(area, new ArrayList<>()));
+            userList.add(map);
+            userMap.put(area, userList);
+        }
+        // 把归类后的用户放入第三层
+        for (Entry<Area, Object> entry : userMap.entrySet()) {
+            if (entry.getKey().getTypeCode() < 3) {
+                // 第一层的child
+                List<Map<String, Object>> list = (List<Map<String, Object>>) result
+                        .get(top.get(entry.getKey().getAreaId())).get("child");
+                // 省级和地市级用户
+                list.get(0).put("child", entry.getValue());
+            } else {
+                // 第一层的child
+                // System.out.println(entry);
+                // System.out.println(result);
+                List<Map<String, Object>> list = (List<Map<String, Object>>) result
+                        .get(top.get(entry.getKey().getParentId())).get("child");
+                // 区县级用户
+                list.get(second.get(entry.getKey().getAreaId())).put("child", entry.getValue());
+            }
+        }
+        // 只保留叶子节点不为空的
+        // 组织结果
+        for (Map<String, Object> map1 : result) {
+            List<Map<String, Object>> list1 = (List<Map<String, Object>>) map1.get("child");
+            for (int i = 0; i < list1.size(); i++) {
+                List<Map<String, Object>> list2 = (List<Map<String, Object>>) list1.get(i).get("child");
+                if (list2.size() == 0) {
+                    list1.remove(i);
+                    i--;
+                }
+            }
+        }
+        return result;
+    }
+
+    public List<String> getPhoneListByRole(int roleId, int cityId) {
+        return userDao.getPhoneListByRole(roleId, cityId);
+    }
+}

+ 30 - 0
src/main/java/com/nokia/service/RoleService.java

@@ -0,0 +1,30 @@
+package com.nokia.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.nokia.dao.RoleDao;
+import com.nokia.pojo.Role;
+
+@Service
+public class RoleService extends ServiceImpl<RoleDao, Role> {
+
+    private final RoleDao roleDao;
+
+    public RoleService(RoleDao roleDao) {
+        this.roleDao = roleDao;
+    }
+
+    public Role getByRoleName(String roleName) {
+        Role roleEntity = new Role();
+        roleEntity.setRoleName(roleName);
+        return getOne(Wrappers.query(roleEntity));
+    }
+
+    public List<Role> getRoleNameLike(String roleName) {
+        return roleDao.findRoleNameLike(roleName);
+    }
+}

+ 28 - 0
src/main/java/com/nokia/service/TopService.java

@@ -0,0 +1,28 @@
+package com.nokia.service;
+
+
+import com.nokia.vo.TokenFlagVo;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+
+@Service
+public class TopService{
+
+    @Value("${top.url}")
+    private String topUrl;
+    @Value("${top.api.fromSystem:tousu}")
+    private String fromSystem;
+
+    public TokenFlagVo topReturn(String token) {
+        HashMap<Object, Object> hashMap = new HashMap<>();
+        hashMap.put("token",token);
+        hashMap.put("fromSystem",fromSystem);
+        RestTemplate restTemplate = new RestTemplate();
+        TokenFlagVo tokenFlagVo = restTemplate.postForObject(topUrl, hashMap, TokenFlagVo.class);
+        return tokenFlagVo;
+    }
+
+}

+ 73 - 0
src/main/java/com/nokia/service/UserService.java

@@ -0,0 +1,73 @@
+package com.nokia.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.nokia.dao.UserDao;
+import com.nokia.dao.UserRoleCityDao;
+import com.nokia.pojo.Area;
+import com.nokia.pojo.Role;
+import com.nokia.pojo.User;
+import com.nokia.pojo.UserRoleCity;
+
+@Service
+public class UserService extends ServiceImpl<UserDao, User> {
+
+    private final UserDao userDao;
+    private final UserRoleCityDao userRoleCityDao;
+
+    @Autowired
+    public UserService(UserDao userDao, UserRoleCityDao userRoleCityDao) {
+        this.userDao = userDao;
+        this.userRoleCityDao = userRoleCityDao;
+    }
+
+    /**
+     * 指定的登陆名是否已存在
+     */
+    public boolean hasLoginName(String loginName) {
+        return null != userDao.hasLoginName(loginName);
+    }
+
+    /**
+     * 用户是否存在某个权限
+     */
+    public boolean hasRoleCity(User user, Role role, Area city) {
+        return null != userRoleCityDao.hasRoleCity(user.getUserId(), role.getRoleId(), city.getAreaId());
+    }
+
+    /**
+     * 添加用户
+     */
+    @Transactional
+    public String add(User user) {
+        User query = new User();
+        query.setLoginName(user.getLoginName());
+        User one = baseMapper.selectOne(Wrappers.query(query));
+        if (one != null) {
+            return "loginName: " + user.getLoginName() + " 已存在";
+        } else {
+            user.setCityId(user.getCity().getAreaId());
+            baseMapper.insert(user);
+        }
+        return "ok";
+    }
+
+    /*
+     * 添加权限
+     */
+    public void addUserRoleCity(UserRoleCity userRoleCity) {
+        userRoleCityDao.insert(userRoleCity);
+    }
+
+    /**
+     * 通过用户的登录名获取用户完整信息
+     */
+    public User getByLoginName(String loginName) {
+        return userDao.getByLoginName(loginName);
+    }
+
+}

+ 41 - 0
src/main/java/com/nokia/vo/DapingUserVo.java

@@ -0,0 +1,41 @@
+package com.nokia.vo;
+
+import com.nokia.pojo.Role;
+import com.nokia.pojo.User;
+import lombok.Data;
+
+/**
+ * 大屏:
+ * 用户姓名
+ * 归属省
+ * 归属地市
+ * 权限:省级/地市级
+ * 
+ * system daping
+ */
+@Data
+public class DapingUserVo {
+    // 用户id
+    private Integer userId;
+    // 用户姓名
+    private String userName;
+    // 归属省份
+    private String province;
+    // 归属地市
+    // private String belongCity;
+    // 权限地市
+    private String city;
+
+    public DapingUserVo(User user) {
+        this.userId = user.getUserId();
+        this.userName = user.getUserName();
+        this.province = user.getProvince().getAreaName();
+        // this.belongCity = user.getCity().getCityNameZh();
+        // 根据权限进行city赋权
+        for (Role role : user.getRoles()) {
+            if ("daping".equals(role.getSystem())) {
+                this.city = role.getCities().get(0).getAreaName();
+            }
+        }
+    }
+}

+ 39 - 0
src/main/java/com/nokia/vo/FenxiUserVo.java

@@ -0,0 +1,39 @@
+package com.nokia.vo;
+
+import com.nokia.pojo.Role;
+import com.nokia.pojo.User;
+import lombok.Data;
+
+/**
+ * 投诉分析用户
+ */
+@Data
+public class FenxiUserVo {
+    // 用户id
+    private Integer id;
+    // 用户登陆名
+    private String account;
+    // 用户姓名
+    private String name;
+    // 1为可用,其他为不可用
+    private Integer status;
+    // 归属地市
+    // private String belongCity;
+    // city为城市id
+    private String city;
+
+    public FenxiUserVo(User user) {
+        this.id = user.getUserId();
+        this.account = user.getLoginName();
+        this.name = user.getUserName();
+        // status永远为1
+        this.status = 1;
+        // this.belongCity = user.getCity().getCityNameZh();
+        // 根据角色进行city赋权
+        for (Role role : user.getRoles()) {
+            if ("fenxi".equals(role.getSystem())) {
+                this.city = role.getCities().get(0).getAreaName();
+            }
+        }
+    }
+}

+ 42 - 0
src/main/java/com/nokia/vo/HeidiankuUserVo.java

@@ -0,0 +1,42 @@
+package com.nokia.vo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.pojo.User;
+
+import lombok.Data;
+
+/**
+ * 黑点库用户信息
+ */
+@Data
+public class HeidiankuUserVo {
+    // 登陆名
+    private String loginName;
+    // 用户姓名
+    private String userName;
+    // 省
+    private String province;
+    // 归属地市
+    private String belongCity;
+    // 赋权地市
+    private String city;
+    // 赋权信息
+    private List<String> roles;
+
+    public HeidiankuUserVo(User userEntity) {
+        this.loginName = userEntity.getLoginName();
+        this.userName = userEntity.getUserName();
+        this.province = userEntity.getProvince().getAreaName();
+        this.belongCity = userEntity.getCity().getAreaName();
+        List<String> roles = new ArrayList<>();
+        userEntity.getRoles().forEach(role -> {
+            if ("heidianku".equals(role.getSystem())) {
+                roles.add(role.getRoleName());
+                this.city = role.getCities().get(0).getAreaName();
+            }
+        });
+        this.roles = roles;
+    }
+}

+ 25 - 0
src/main/java/com/nokia/vo/LiuchengUserVo.java

@@ -0,0 +1,25 @@
+package com.nokia.vo;
+
+import com.nokia.pojo.User;
+import lombok.Data;
+
+/**
+ * 用于acl返回给工单流转系统的用户信息
+ * <p>
+ * 流转:
+ * 用户账号(account),
+ * 用户ID(userId),
+ * 用户名称(userName)
+ */
+@Data
+public class LiuchengUserVo {
+    private String account;
+    private Integer userId;
+    private String userName;
+
+    public LiuchengUserVo(User userEntity) {
+        this.account = userEntity.getLoginName();
+        this.userId = userEntity.getUserId();
+        this.userName = userEntity.getUserName();
+    }
+}

+ 17 - 0
src/main/java/com/nokia/vo/TokenFlagVo.java

@@ -0,0 +1,17 @@
+package com.nokia.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TokenFlagVo {
+    private Integer isValid;//0是 1否
+    private String loginName;//用户oa名,若isValid的值为1,则用户名为空字符串
+
+    public boolean isValid() {
+        return this.isValid == 0;
+    }
+}

+ 15 - 0
src/main/java/com/nokia/vo/TokenVo.java

@@ -0,0 +1,15 @@
+package com.nokia.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 无用实体类
+ */
+@Data
+public class TokenVo implements Serializable {
+    private String token;
+    private String system;
+    private String fromSystem;
+}

+ 10 - 0
src/main/java/com/nokia/vo/UserVo.java

@@ -0,0 +1,10 @@
+package com.nokia.vo;
+
+import lombok.Data;
+
+@Data
+public class UserVo {
+    private  String  account;
+    private Integer userId;
+    private String userName;
+}

+ 17 - 0
src/main/java/com/nokia/vo/VolteT2UserVo.java

@@ -0,0 +1,17 @@
+package com.nokia.vo;
+
+import com.nokia.pojo.User;
+
+import lombok.Data;
+
+/*
+ * 用于封装volte分析T2页面鉴权返回消息
+ */
+@Data
+public class VolteT2UserVo {
+    private String loginName;
+
+    public VolteT2UserVo(User user) {
+        this.loginName = user.getLoginName();
+    }
+}

+ 31 - 0
src/main/java/com/nokia/vo/YuceUserVo.java

@@ -0,0 +1,31 @@
+package com.nokia.vo;
+
+import com.nokia.pojo.Role;
+import com.nokia.pojo.User;
+import lombok.Data;
+
+@Data
+public class YuceUserVo {
+    // 用户id
+    private Integer userId;
+    // 姓名
+    private String userName;
+    // 省
+    private String province;
+    // 归属地市
+    // private String belongCity;
+    // 权限地市
+    private Integer city;
+
+    public YuceUserVo(User user) {
+        this.userId = user.getUserId();
+        this.userName = user.getUserName();
+        this.province = user.getProvince().getAreaName();
+        // this.belongCity = user.getCity().getCityNameZh();
+        for (Role role : user.getRoles()) {
+            if ("yuce".equals(role.getSystem())) {
+                this.city = role.getCities().get(0).getAreaId();
+            }
+        }
+    }
+}

+ 9 - 0
src/main/java/com/nokia/vo/flow/FlowOrgVo.java

@@ -0,0 +1,9 @@
+package com.nokia.vo.flow;
+
+import lombok.Data;
+
+@Data
+public class FlowOrgVo {
+    private Integer orgId;
+    private String orgName;
+}

+ 28 - 0
src/main/java/com/nokia/vo/flow/FlowRoleCityVo.java

@@ -0,0 +1,28 @@
+package com.nokia.vo.flow;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.pojo.Area;
+import com.nokia.pojo.Role;
+
+import lombok.Data;
+
+@Data
+public class FlowRoleCityVo {
+    // 角色id
+    private Integer roleId;
+    // 角色名
+    private String roleName;
+    // 赋权地市
+    private List<Integer> cities;
+
+    public FlowRoleCityVo(Role role) {
+        this.roleId = role.getRoleId();
+        this.roleName = role.getRoleName();
+        this.cities = new ArrayList<>();
+        for (Area city : role.getCities()) {
+            this.cities.add(city.getAreaId());
+        }
+    }
+}

+ 11 - 0
src/main/java/com/nokia/vo/flow/FlowRoleVo.java

@@ -0,0 +1,11 @@
+package com.nokia.vo.flow;
+
+import lombok.Data;
+
+@Data
+public class FlowRoleVo {
+    // 角色id
+    private Integer roleId;
+    // 角色名
+    private String roleName;
+}

+ 18 - 0
src/main/java/com/nokia/vo/flow/FlowUserVo.java

@@ -0,0 +1,18 @@
+package com.nokia.vo.flow;
+
+import lombok.Data;
+
+/*
+ * 返回给流程的单用户信息
+ */
+@Data
+public class FlowUserVo {
+    private Integer userId;
+    private String loginId;
+    private String userName;
+    private String mobile;
+    private String email;
+    private FlowOrgVo org;
+    // 区县Id 对应 User 的 districtId
+    private Integer area;
+}

+ 13 - 0
src/main/java/com/nokia/vo/flow/UserTreeReq.java

@@ -0,0 +1,13 @@
+package com.nokia.vo.flow;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Data;
+
+@Data
+public class UserTreeReq {
+    private Integer city;
+    private List<Integer> role = new ArrayList<>();
+    private List<Integer> user = new ArrayList<>();
+}

+ 18 - 0
src/main/resources/application-develop.properties

@@ -0,0 +1,18 @@
+# web服务端口号
+server.port=12128
+
+# log配置
+logging.level.root=info
+logging.level.com.nokia=debug
+
+# 开发环境数据库配置
+spring.datasource.driver-class-name=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/postgres
+spring.datasource.username=postgres
+spring.datasource.password=fantuan1985
+
+# 开发环境redis配置 由于测试环境redis尚不具备,暂时先用正式环境的 10 顶替一下,具备后再调整
+spring.redis.host=127.0.0.1
+spring.redis.port=6379
+spring.redis.database=0
+redis.timeoutSeconds=600

+ 19 - 0
src/main/resources/application-product.properties

@@ -0,0 +1,19 @@
+# web服务端口号
+server.port=12128
+
+# log配置
+logging.level.root=info
+logging.level.com.nokia=debug
+
+# 正式环境数据源GP数据库配置
+spring.datasource.driver-class-name=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://192.168.70.109:5432/sqmmt
+spring.datasource.username=sqmdb
+spring.datasource.password=sqmdb_1QAZ
+
+# 正式环境Redis配置
+spring.redis.host=192.168.70.125
+spring.redis.port=6379
+spring.redis.database=0
+spring.redis.password=Richr00t
+redis.timeoutSeconds=600

+ 19 - 0
src/main/resources/application-test.properties

@@ -0,0 +1,19 @@
+# web服务端口号
+server.port=12128
+
+# log配置
+logging.level.root=info
+logging.level.com.nokia=debug
+
+# 测试环境数据库配置
+spring.datasource.driver-class-name=org.postgresql.Driver
+spring.datasource.url=jdbc:postgresql://192.168.50.5:5432/sqmmt
+spring.datasource.username=sqmdb
+spring.datasource.password=sqmdb_1QAZ
+
+# 测试环境redis配置 由于测试环境redis尚不具备,暂时先用正式环境的 10 顶替一下,具备后再调整
+spring.redis.host=192.168.70.125
+spring.redis.port=6379
+spring.redis.database=10
+spring.redis.password=Richr00t
+redis.timeoutSeconds=600

+ 11 - 0
src/main/resources/application.properties

@@ -0,0 +1,11 @@
+# 启用的配置
+spring.profiles.active=develop
+
+top.url=http://10.17.180.3/prod-api/verifySystem
+dop.url=http://10.17.180.5:8089/prod-api/verifySystem
+top.api.fromSystem=dh
+dop.api.fromSystem=dh
+top.redirect.url=https://133.96.90.208/login
+dop.redirect.url=http://133.96.90.210:8089/login
+
+mybatis.mapper-locations=classpath*:mapper/**/**Mapper.xml

+ 104 - 0
src/main/resources/mapper/UserMapper.xml

@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.nokia.dao.UserDao">
+    <resultMap id="UserResultMap" type="com.nokia.pojo.User">
+        <id column="user_id" property="userId"></id>
+        <result column="login_name" property="loginName" />
+        <result column="user_name" property="userName" />
+        <result column="phone" property="phone" />
+        <result column="email" property="email" />
+        <result column="province_id" property="provinceId" />
+        <result column="city_id" property="cityId" />
+        <result column="area_id" property="areaId" />
+        <association column="province_id" property="province">
+            <id column="province_id" property="areaId"></id>
+            <result column="province_Name" property="areaName" />
+        </association>
+        <association column="city_id" property="city">
+            <id column="city_id" property="areaId"></id>
+            <result column="city_name" property="areaName" />
+            <result column="type_code" property="typeCode" />
+            <result column="city_parent_id" property="parentId" />
+        </association>
+        <association column="area_id" property="area">
+            <id column="area_id" property="areaId"></id>
+            <result column="area_name" property="areaName" />
+            <result column="area_type_code" property="typeCode" />
+            <result column="area_parent_id" property="parentId" />
+        </association>
+        <collection property="roles" resultMap="RoleResultMap" />
+    </resultMap>
+
+    <resultMap id="RoleResultMap" type="com.nokia.pojo.Role">
+        <id column="role_id" property="roleId"></id>
+        <result column="role_name" property="roleName" />
+        <result column="system" property="system" />
+        <collection property="cities" ofType="com.nokia.pojo.Area">
+            <result column="role_city_id" property="areaId" />
+            <result column="role_area_name" property="areaName" />
+        </collection>
+    </resultMap>
+
+    <select id="getRoleCityByUserId" resultMap="RoleResultMap">
+        select ar.role_id, ar.role_name, ar."system", aurc.city_id as role_city_id, ac.area_name as role_area_name 
+            from sqmdb_rpt.acl_role ar, sqmdb_rpt.acl_user_role_city aurc,  sqmdb_rpt.acl_area ac
+            where ar.role_id = aurc.role_id and aurc.city_id = ac.area_id  and aurc.user_id = #{userId}
+    </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,
+                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 1=1
+            and tmp.login_name = #{loginName}
+    </select>
+
+    <select id="getByRoleIds" resultMap="UserResultMap">
+        select tmp.*, ac4.area_name, ac4.type_code as area_type_code, 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,
+                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.user_id != 1
+        <if test="roleIds != null">
+            and tmp.role_id in
+            <foreach collection="roleIds" item="item" open="(" separator="," close=")" index="index">
+                #{item}
+            </foreach>
+        </if>
+        <if test="cityIds != null">
+            and tmp.role_city_id in
+            <foreach collection="cityIds" item="item" open="(" separator="," close=")" index="index">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getPhoneListByRole" resultType="java.lang.String">
+        select distinct  phone 
+            from sqmdb_rpt.acl_user au , sqmdb_rpt.acl_user_role_city aurc 
+            where au.user_id = aurc.user_id and aurc.role_id = #{roleId} and aurc.city_id = #{cityId}
+    </select>
+</mapper>

+ 20 - 0
src/test/java/com/nokia/OtherTest.java

@@ -0,0 +1,20 @@
+package com.nokia;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.redis.core.RedisTemplate;
+
+@SpringBootTest
+public class OtherTest {
+    
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
+    @Test
+    void test() {
+        Object object = redisTemplate.opsForValue().get("abc");
+        System.out.println(object);
+        System.out.println("done!");
+    }
+}

+ 34 - 0
src/test/java/com/nokia/dao/AreaDaoTest.java

@@ -0,0 +1,34 @@
+package com.nokia.dao;
+
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import com.nokia.pojo.Area;
+
+@SpringBootTest
+public class AreaDaoTest {
+
+    @Autowired
+    private AreaDao areaDao;
+
+    @Test
+    void testGetAll() {
+        List<Area> result = areaDao.getAll();
+        System.out.println(result);
+    }
+
+    @Test
+    void testGetByParentId() {
+        List<Area> result = areaDao.getByParentId(-1);
+        System.out.println(result);
+    }
+
+    @Test
+    void testGetByAreaId() {
+        Area area = areaDao.getByAreaId(130100);
+        System.out.println(area);
+    }
+}

+ 28 - 0
src/test/java/com/nokia/dao/RoleDaoTest.java

@@ -0,0 +1,28 @@
+package com.nokia.dao;
+
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import com.nokia.pojo.Role;
+
+@SpringBootTest
+public class RoleDaoTest {
+
+    @Autowired
+    private RoleDao roleDao;
+
+    @Test
+    void testFindByUserId() {
+        List<Role> roles = roleDao.findByUserId(10);
+        System.out.println(roles);
+    }
+
+    @Test
+    void testFindRoleNameLike() {
+        List<Role> roles = roleDao.findRoleNameLike("工单");
+        System.out.println(roles);
+    }
+}

+ 24 - 0
src/test/java/com/nokia/dao/RoleEntityDaoTest.java

@@ -0,0 +1,24 @@
+package com.nokia.dao;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.nokia.pojo.Role;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class RoleEntityDaoTest {
+    @Autowired
+    private RoleDao roleDao;
+
+    @Test
+    public void test() {
+        Role roleEntity = new Role();
+        roleEntity.setRoleName("管理员");
+        roleDao.insert(roleEntity);
+        List<Role> roleEntities = roleDao.selectList(Wrappers.query());
+        System.out.println(roleEntities);
+    }
+}

+ 102 - 0
src/test/java/com/nokia/dao/UserDaoTest.java

@@ -0,0 +1,102 @@
+package com.nokia.dao;
+
+import com.nokia.pojo.Role;
+import com.nokia.pojo.User;
+import com.nokia.vo.flow.FlowRoleVo;
+import com.nokia.vo.flow.FlowUserVo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class UserDaoTest {
+
+    @Autowired
+    UserDao userDao;
+
+    @Test
+    void testFindRoleList() {
+        List<FlowRoleVo> flowRoleVos = userDao.findRoleList("测试用户_全省");
+        System.out.println(flowRoleVos);
+    }
+
+    @Test
+    void testFindRoleList2() {
+        List<FlowRoleVo> flowRoleVos = userDao.findRoleList2();
+        System.out.println(flowRoleVos);
+    }
+
+    @Test
+    void testFindToPage() {
+        List<FlowUserVo> flowRoleVos = userDao.findToPage();
+        System.out.println(flowRoleVos);
+    }
+
+    @Test
+    void testGetFlowUserVoByLoginId() {
+        FlowUserVo flowUserVo = userDao.getFlowUserVoByLoginId("test_hengshui");
+        System.out.println(flowUserVo);
+    }
+
+    @Test
+    void testGetFlowUserVoByUserId() {
+        FlowUserVo flowUserVo = userDao.getFlowUserVoByUserId(3);
+        System.out.println(flowUserVo);
+    }
+
+    @Test
+    void testFindRoleIdByUserId() {
+        List<Integer> roleIds = userDao.findRoleIdByUserId(4);
+        System.out.println(roleIds);
+    }
+
+    @Test
+    void testFindUserIdByRoleId() {
+        List<Integer> userIds = userDao.findUserIdByRoleId(6);
+        System.out.println(userIds);
+    }
+
+    @Test
+    void testFindAuthorizedUser() {
+        List<FlowUserVo> flowUserVos = userDao.findAuthorizedUser(null, null, null);
+        System.out.println(flowUserVos);
+    }
+
+    @Test
+    void testGetRoleCityByUserId() {
+        List<Role> roles = userDao.getRoleCityByUserId(4);
+        System.out.println(roles);
+    }
+
+    @Test
+    void testGetByLoginName() {
+        User user = userDao.getByLoginName("test_hengshui");
+        System.out.println(user);
+    }
+
+    @Test
+    void testGetByRoleIds() {
+        List<Integer> roleIds = new ArrayList<>();
+        roleIds.add(4);
+        // roleIds.add(3);
+
+        List<Integer> cityIds = new ArrayList<>();
+        cityIds.add(-1);
+        cityIds.add(130100);
+
+        List<User> users = userDao.getByRoleIds(roleIds, cityIds);
+        System.out.println(users);
+    }
+
+    @Test
+    void testGetPhoneListByRole() {
+        int roleId = 7;
+        int cityId = 130200;
+        List<String> phoneList = userDao.getPhoneListByRole(roleId, cityId);
+        System.out.println(phoneList);
+    }
+}

+ 45 - 0
src/test/java/com/nokia/dao/UserRoleCityDaoTest.java

@@ -0,0 +1,45 @@
+package com.nokia.dao;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import com.nokia.pojo.UserRoleCity;
+
+@SpringBootTest
+public class UserRoleCityDaoTest {
+
+    @Autowired
+    private UserRoleCityDao userRoleCityDao;
+
+    @Test
+    void testHasRoleCity() {
+        Integer result = userRoleCityDao.hasRoleCity(4, 16, 130200);
+        System.out.println(result);
+    }
+
+    @Test
+    void test() {
+        UserRoleCity userRoleCity = new UserRoleCity();
+        // test_abc
+        userRoleCity.setUserId(4);
+        // 投诉分析
+        userRoleCity.setRoleId(16);
+        // 唐山
+        userRoleCity.setCityId(130200);
+        userRoleCityDao.insert(userRoleCity);
+    }
+
+    @Test
+    void test2() {
+        UserRoleCity userRoleCity = new UserRoleCity();
+        // test_abc
+        userRoleCity.setUserId(4);
+        // 投诉分析
+        userRoleCity.setRoleId(18);
+        // 唐山
+        userRoleCity.setCityId(130200);
+        userRoleCityDao.insert(userRoleCity);
+    }
+
+}

+ 70 - 0
src/test/java/com/nokia/service/FlowServiceTest.java

@@ -0,0 +1,70 @@
+package com.nokia.service;
+
+import java.util.List;
+import java.util.Map;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import com.nokia.vo.flow.UserTreeReq;
+
+@SpringBootTest
+public class FlowServiceTest {
+    @Autowired
+    private FlowService service;
+
+    @Test
+    void testFindAuthorizedUser() {
+
+    }
+
+    @Test
+    void testFindRoleIdByUserId() {
+
+    }
+
+    @Test
+    void testFindRoleList() {
+
+    }
+
+    @Test
+    void testFindRoleList2() {
+
+    }
+
+    @Test
+    void testFindToPage() {
+
+    }
+
+    @Test
+    void testFindUserIdByRoleId() {
+
+    }
+
+    @Test
+    void testGetByLoginId() {
+
+    }
+
+    @Test
+    void testGetByUserId() {
+
+    }
+
+    @Test
+    void testGetRoleCityByUserId() {
+
+    }
+
+    @Test
+    void testGetUserTree() {
+        UserTreeReq req = new UserTreeReq();
+        req.setCity(130300);
+        req.getRole().add(6);
+        List<Map<String, Object>> userTree = service.getUserTree(req);
+        System.out.println(userTree);
+    }
+}

+ 28 - 0
src/test/java/com/nokia/service/RoleServiceTest.java

@@ -0,0 +1,28 @@
+package com.nokia.service;
+
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import com.nokia.pojo.Role;
+
+@SpringBootTest
+public class RoleServiceTest {
+
+    @Autowired
+    private RoleService roleService;
+
+    @Test
+    void testGetByRoleName() {
+        Role role = roleService.getByRoleName("工单答复");
+        System.out.println(role);
+    }
+
+    @Test
+    void testGetRoleNameLike() {
+        List<Role> roles = roleService.getRoleNameLike("工单");
+        System.out.println(roles);
+    }
+}

+ 104 - 0
src/test/java/com/nokia/service/UserServiceTest.java

@@ -0,0 +1,104 @@
+package com.nokia.service;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.redis.core.RedisTemplate;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.nokia.dao.UserDao;
+import com.nokia.dao.UserRoleCityDao;
+import com.nokia.pojo.User;
+import com.nokia.pojo.UserRoleCity;
+
+@SpringBootTest
+public class UserServiceTest {
+
+    @Autowired
+    private UserService userService;
+    @Autowired
+    private UserDao userDao;
+    @Autowired
+    private UserRoleCityDao userRoleCityDao;
+
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
+    @Test
+    void testRedisTemplate() {
+        Object value = redisTemplate.opsForValue().get("test_token_hengshui");
+        System.out.println(value);
+        // Boolean delete = redisTemplate.delete("test_token_hengshui");
+        // System.out.println(delete);
+        // value = redisTemplate.opsForValue().get("test_token_hengshui");
+        // System.out.println(value);
+    }
+
+    @Test
+    void testGetByLoginName() {
+        User user = userService.getByLoginName("test_abc");
+        System.out.println(user);
+    }
+
+    @Test
+    void testAddUserRoleCity() throws FileNotFoundException, IOException {
+        try (BufferedReader reader = new BufferedReader(
+                new FileReader("/Users/lfq/Documents/code/acl_tousu/ignored/user_role_city.txt"))) {
+            String line = null;
+            while ((line = reader.readLine()) != null) {
+                String[] strs = line.split("\t");
+                UserRoleCity userRoleCity = new UserRoleCity();
+                userRoleCity.setUserId(Integer.parseInt(strs[0]));
+                userRoleCity.setCityId(Integer.parseInt(strs[1]));
+                userRoleCity.setRoleId(Integer.parseInt(strs[2]));
+                UserRoleCity selectOne = userRoleCityDao.selectOne(Wrappers.query(userRoleCity));
+                // if (selectOne != null) {
+                //     System.out.println("=======================================" + selectOne);
+                //     // return;
+                // } else {
+                //     userService.addUserRoleCity(userRoleCity);
+                // }
+                System.out.println(selectOne);
+                selectOne.setCityId(userRoleCity.getRoleId());
+                selectOne.setRoleId(userRoleCity.getCityId());
+                userRoleCityDao.updateById(selectOne);
+                // userService.addUserRoleCity(userRoleCity);
+            }
+        }
+    }
+
+    @Test
+    void testAddUser() throws FileNotFoundException, IOException {
+        try (BufferedReader reader = new BufferedReader(
+                new FileReader("C:\\Users\\lfq\\Documents\\code\\acl_tousu\\ignored\\user.txt"))) {
+            String line = null;
+            while ((line = reader.readLine()) != null) {
+                System.out.println(line);
+                String[] strs = line.split("\t");
+                System.out.println(Arrays.toString(strs));
+                User user = new User();
+                user.setLoginName(strs[0]);
+                user.setUserName(strs[1]);
+                user.setPhone(strs[2]);
+                user.setEmail(strs[3]);
+                user.setCityId(Integer.parseInt(strs[4]));
+                Integer areaId = null;
+                try {
+                    areaId = Integer.parseInt(strs[5]);
+                } catch (Exception e) {}
+                user.setAreaId(areaId);
+                user.setProvinceId(Integer.parseInt(strs[6]));
+                user.setOrg(strs[7]);
+                System.out.println(user);
+                userDao.insert(user);
+            }
+        }
+    }
+
+}