Browse Source

Merge branch 'master' of http://116.63.33.55/git/read_opc

FinalYu 2 years ago
parent
commit
98d4fb1dd5
77 changed files with 1618 additions and 720 deletions
  1. 1 0
      chuanyi-admin/package.json
  2. 17 2
      chuanyi-admin/src/App.vue
  3. 9 0
      chuanyi-admin/src/api/system/dict.js
  4. 9 0
      chuanyi-admin/src/api/system/dictType.js
  5. 20 2
      chuanyi-admin/src/api/system/menu.js
  6. 10 1
      chuanyi-admin/src/api/system/role.js
  7. 5 5
      chuanyi-admin/src/layout/components/Navbar.vue
  8. 4 0
      chuanyi-admin/src/main.js
  9. 5 5
      chuanyi-admin/src/router/index.js
  10. 6 2
      chuanyi-admin/src/views/system/auth/index.vue
  11. 6 0
      chuanyi-admin/src/views/system/demo/demo.vue
  12. 35 36
      chuanyi-admin/src/views/system/dept/index.vue
  13. 39 27
      chuanyi-admin/src/views/system/dict/dict-detail.vue
  14. 14 4
      chuanyi-admin/src/views/system/dict/index.vue
  15. 3 1
      chuanyi-admin/src/views/system/log/index.vue
  16. 42 15
      chuanyi-admin/src/views/system/menu/index.vue
  17. 8 9
      chuanyi-admin/src/views/system/menu/menu-auth.vue
  18. 6 4
      chuanyi-admin/src/views/system/menu/menu-dist.vue
  19. 63 0
      chuanyi-admin/src/views/system/mixins/multiple.js
  20. 77 0
      chuanyi-admin/src/views/system/mixins/multipleCheck.js
  21. 7 4
      chuanyi-admin/src/views/system/role/index.vue
  22. 4 4
      chuanyi-admin/src/views/system/role/role-auth.vue
  23. 164 0
      chuanyi-admin/src/views/system/role/role-menu.vue
  24. 170 0
      chuanyi-admin/src/views/system/role/role-menuSelect.vue
  25. 0 0
      chuanyi-admin/src/views/system/role/role-select.vue
  26. 0 394
      chuanyi-admin/src/views/system/role/user-menu.vue
  27. 31 10
      chuanyi-admin/src/views/system/user/index.vue
  28. 6 0
      chuanyi_server/pom.xml
  29. 0 23
      chuanyi_server/src/main/java/com/judong/chuanyiserver/config/KepOpcServerTimerTask.java
  30. 29 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/config/MessageReceiver.java
  31. 65 67
      chuanyi_server/src/main/java/com/judong/chuanyiserver/config/OpcAsyncTask.java
  32. 30 2
      chuanyi_server/src/main/java/com/judong/chuanyiserver/config/RedisConfig.java
  33. 3 3
      chuanyi_server/src/main/java/com/judong/chuanyiserver/config/ThreadPoolConfig.java
  34. 11 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/DataSourceController.java
  35. 23 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/DictController.java
  36. 19 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/ItemGroupController.java
  37. 8 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/RawDataController.java
  38. 17 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/ReportTableController.java
  39. 43 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/RoleController.java
  40. 4 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/DictDao.java
  41. 10 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/FileDao.java
  42. 2 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/ItemGroupDao.java
  43. 7 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/ReportTableDao.java
  44. 25 1
      chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/RoleDao.java
  45. 5 1
      chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/UserDao.java
  46. 44 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/entity/FileEntity.java
  47. 2 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/entity/Item.java
  48. 9 7
      chuanyi_server/src/main/java/com/judong/chuanyiserver/enums/ModelEnum.java
  49. 1 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/enums/OperationEnum.java
  50. 4 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/DictService.java
  51. 3 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/ItemGroupService.java
  52. 6 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/RawDataService.java
  53. 4 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/ReportTableService.java
  54. 15 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/RoleService.java
  55. 0 7
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/ChannelSettingServiceImpl.java
  56. 1 2
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/DataSourceServiceImpl.java
  57. 10 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/DictServiceImpl.java
  58. 9 5
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/ItemGroupServiceImpl.java
  59. 6 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/MenuServiceImpl.java
  60. 8 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/RawDataServiceImpl.java
  61. 16 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/ReportTableServiceImpl.java
  62. 43 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/RoleServiceImpl.java
  63. 58 14
      chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/UserServiceImpl.java
  64. 17 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/task/KepServerTimerTask.java
  65. 17 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/task/OpcUaTimerTask.java
  66. 98 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/util/FileUtil.java
  67. 6 2
      chuanyi_server/src/main/java/com/judong/chuanyiserver/util/MathUtil.java
  68. 34 1
      chuanyi_server/src/main/java/com/judong/chuanyiserver/util/OpcUaUtil.java
  69. 0 54
      chuanyi_server/src/main/java/com/judong/chuanyiserver/util/Test.java
  70. 53 0
      chuanyi_server/src/main/java/com/judong/chuanyiserver/util/TestUtil.java
  71. 1 1
      chuanyi_server/src/main/resources/mapper/DepartmentDao.xml
  72. 8 0
      chuanyi_server/src/main/resources/mapper/DictDao.xml
  73. 10 0
      chuanyi_server/src/main/resources/mapper/FileDao.xml
  74. 10 4
      chuanyi_server/src/main/resources/mapper/ItemGroupDao.xml
  75. 5 0
      chuanyi_server/src/main/resources/mapper/ReportTableDao.xml
  76. 39 1
      chuanyi_server/src/main/resources/mapper/RoleDao.xml
  77. 19 0
      chuanyi_server/src/main/resources/mapper/UserDao.xml

+ 1 - 0
chuanyi-admin/package.json

@@ -47,6 +47,7 @@
     "vue-splitpane": "1.0.4",
     "vuedraggable": "2.20.0",
     "vuex": "3.1.0",
+    "vxe-table": "^3.6.9",
     "vxe-utils": "^2.0.1",
     "xe-utils": "^3.5.7",
     "xlsx": "0.14.1"

+ 17 - 2
chuanyi-admin/src/App.vue

@@ -74,12 +74,27 @@ export default {
   color: rgb(103, 102, 102);
 }
 
-.czBtns{
-  margin-bottom:20px;
+.czBtns {
+  margin-bottom: 20px;
 }
 
 .scrollbar-wrapper::-webkit-scrollbar {
   display: none;
   /* Chrome Safari */
 }
+
+.vxe-icon-checkbox-unchecked {
+  font-size: 16px !important;
+  font-weight: 500 !important;
+}
+
+.vxe-icon-checkbox-checked {
+  font-size: 16px !important;
+  font-weight: 500 !important;
+}
+
+.vxe-icon-checkbox-indeterminate {
+  font-size: 16px !important;
+  font-weight: 500 !important;
+}
 </style>

+ 9 - 0
chuanyi-admin/src/api/system/dict.js

@@ -48,6 +48,15 @@ export function addDict(data) {
   })
 }
 
+// 查询字典详情
+export function getDictDetail(query) {
+  return request({
+    url: '/dict/queryDictById',
+    method: 'get',
+    params: query
+  })
+}
+
 // 编辑字典
 export function editDict(data) {
   return request({

+ 9 - 0
chuanyi-admin/src/api/system/dictType.js

@@ -27,6 +27,15 @@ export function editDictType(data) {
   })
 }
 
+// 查询字典类型详情
+export function getDictTypeDetail(query) {
+  return request({
+    url: '/dict/queryDictTypeById',
+    method: 'get',
+    params: query
+  })
+}
+
 // 新增字典类型
 export function addDictType(data) {
   return request({

+ 20 - 2
chuanyi-admin/src/api/system/menu.js

@@ -57,7 +57,7 @@ export function getTreeMenuList(query) {
 // 分配菜单接口权限
 export function distMenuAuth(data) {
   return request({
-    url: '/menu/assignMenuAndPermission',
+    url: '/menu/addMenuAndPermission',
     method: 'post',
     data
   })
@@ -75,8 +75,26 @@ export function getAllAuthApi(query) {
 // 取消菜单对应权限
 export function delMenuAuth(data) {
   return request({
-    url: '/menu/deleteMenuPermission',
+    url: '/menu/deleteMenuAndPermission',
     method: 'post',
     data
   })
 }
+
+// 查询已分配菜单权限列表
+export function getMenuAuthList(query) {
+  return request({
+    url: '/menu/queryPermission',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询未分配菜单权限列表
+export function getNotMenuAuthList(query) {
+  return request({
+    url: '/menu/queryNotPermission',
+    method: 'get',
+    params: query
+  })
+}

+ 10 - 1
chuanyi-admin/src/api/system/role.js

@@ -52,7 +52,7 @@ export function delRoleById(data) {
   })
 }
 
-// 通过角色查询拥有的菜单信息
+// 通过角色查询拥有的菜单信息
 export function getMenuListByRoleId(data) {
   return request({
     url: '/role/getMenuListByRoleList',
@@ -95,3 +95,12 @@ export function delRolesById(data) {
     data
   })
 }
+
+// 角色已有菜单id集合
+export function getRoleMenuIds(query) {
+  return request({
+    url: '/role/queryRoleAndMenuListId',
+    method: 'get',
+    params: query
+  })
+}

+ 5 - 5
chuanyi-admin/src/layout/components/Navbar.vue

@@ -48,6 +48,7 @@
               :type="passwordType1"
               style="width:300px"
               auto-complete="new-password"
+              maxlength="20"
             />
             <span class="show-pwd" @click="showPwd(1)">
               <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
@@ -60,6 +61,7 @@
               placeholder="请输入新密码"
               :type="passwordType2"
               style="width:300px"
+              maxlength="20"
             />
             <span class="show-pwd" @click="showPwd(2)">
               <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
@@ -72,6 +74,7 @@
               placeholder="请再次输入新密码"
               :type="passwordType3"
               style="width:300px"
+              maxlength="20"
             />
             <span class="show-pwd" @click="showPwd(3)">
               <svg-icon :icon-class="passwordType3 === 'password' ? 'eye' : 'eye-open'" />
@@ -135,7 +138,8 @@ export default {
       // 修改密码表单
       form: {
         password: null,
-        newPassword: null
+        newPassword: null,
+        confimPassword: null
       },
       // 表单验证
       rules: {
@@ -185,10 +189,6 @@ export default {
     async logout() {
       const res = await this.$store.dispatch('user/Logout')
       if (res.code === 200) {
-        this.$message({
-          type: 'success',
-          message: '退出成功'
-        })
         this.$router.push('/login')
       }
     },

+ 4 - 0
chuanyi-admin/src/main.js

@@ -18,12 +18,16 @@ import XEUtils from 'xe-utils'
 import VXEUtils from 'vxe-utils'
 import _ from 'lodash'
 
+import VXETable from 'vxe-table'
+import 'vxe-table/lib/style.css'
+
 import { resetBtn } from './utils'
 
 Vue.prototype.$resetBtn = resetBtn
 
 Vue.prototype._ = _
 Vue.use(VXEUtils, XEUtils, { mounts: ['cookie'] })
+Vue.use(VXETable)
 /**
  * If you don't want to use mock-server
  * you want to use MockJs for mock api

+ 5 - 5
chuanyi-admin/src/router/index.js

@@ -79,26 +79,26 @@ export const constantRoutes = [
     ]
   },
   {
-    path: '/system/role/user-auth',
+    path: '/system/role/role-auth',
     component: Layout,
     hidden: true,
     children: [
       {
         path: 'role/:userId(\\d+)',
-        component: () => import('@/views/system/role/user-auth'),
+        component: () => import('@/views/system/role/role-auth'),
         name: 'AuthRole',
         meta: { title: '分配用户', activeMenu: '/system/role' }
       }
     ]
   },
   {
-    path: '/system/role/user-menu',
+    path: '/system/role/role-menu',
     component: Layout,
     hidden: true,
     children: [
       {
         path: 'role/:userId(\\d+)',
-        component: () => import('@/views/system/role/user-menu'),
+        component: () => import('@/views/system/role/role-menu'),
         name: 'AuthRole',
         meta: { title: '分配菜单', activeMenu: '/system/role' }
       }
@@ -126,7 +126,7 @@ export const constantRoutes = [
         path: 'auth/:userId(\\d+)',
         component: () => import('@/views/system/menu/menu-auth'),
         name: 'MenuAuth',
-        meta: { title: '分配接口', activeMenu: '/system/menu' }
+        meta: { title: '分配权限', activeMenu: '/system/menu' }
       }
     ]
   }

+ 6 - 2
chuanyi-admin/src/views/system/auth/index.vue

@@ -88,7 +88,8 @@ export default {
       // 查询参数
       queryParams: {
         page: 1,
-        limit: 10
+        limit: 10,
+        permissionName: null
       },
       // 总条数
       total: 0,
@@ -99,7 +100,10 @@ export default {
       // 弹出框标题
       title: '',
       // 弹出框表单
-      form: {},
+      form: {
+        permissionName: null,
+        permissionUrl: null
+      },
       // 菜单类别
       options: [],
       // 表单验证

+ 6 - 0
chuanyi-admin/src/views/system/demo/demo.vue

@@ -0,0 +1,6 @@
+<template>
+  <div>
+    123
+  </div>
+</template>
+

+ 35 - 36
chuanyi-admin/src/views/system/dept/index.vue

@@ -29,34 +29,22 @@
 
         <!-- 表格数据信息 -->
         <el-table
-          ref="deptTable"
-          v-loading="loading"
-          :data="deptList"
+          ref="table"
+          :data="mulData"
           row-key="id"
           border
-          stripe
           header-row-class-name="headBackground"
-          @selection-change="handleSelectionChange"
+          @select="select"
+          @select-all="selectAll"
+          @selection-change="selectChange"
         >
-          <el-table-column type="selection" width="50" align="center" />
-          <el-table-column
-            key="departmentName"
-            label="部门名称"
-            align="center"
-            prop="departmentName"
-            show-overflow-tooltip
-          />
-          <el-table-column
-            key="departmentDescribe"
-            label="部门描述"
-            align="center"
-            prop="departmentDescribe"
-            show-overflow-tooltip
-          />
-          <el-table-column key="departmentNum" label="排序号" align="center" prop="departmentNum" />
-          <el-table-column key="updateTime" label="更新时间" align="center" prop="updateTime" />
-          <el-table-column key="createTime" label="创建时间" align="center" prop="createTime" />
-          <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width">
+          <el-table-column type="selection" align="center" />
+          <el-table-column label="部门名称" prop="departmentName" show-overflow-tooltip header-align="center" />
+          <el-table-column label="部门描述" prop="departmentDescribe" show-overflow-tooltip align="center" />
+          <el-table-column label="排序号" prop="departmentNum" show-overflow- align="center" />
+          <el-table-column label="更新时间" prop="updateTime" show-overflow-tooltip align="center" />
+          <el-table-column label="创建时间" prop="createTime" show-overflow-tooltip align="center" />
+          <el-table-column label="操作" align="center">
             <template slot-scope="scope">
               <el-button size="mini" type="text" icon="el-icon-edit" @click="handelEdit(scope.row.id)">修改
               </el-button>
@@ -133,8 +121,10 @@
 <script>
 import { getDeptList, addDept, getDeptById, editDept, delDept, getAllSonMenuList } from '@/api/system/dept.js'
 import selectTree from '@/components/SelectTree'
+import multiple from '@/views/system/mixins/multiple'
 export default {
   components: { selectTree },
+  mixins: [multiple],
   data() {
     const departmentNum = (rule, value, callback) => {
       var reg = /^[1-9][0-9]*$/
@@ -152,19 +142,21 @@ export default {
       // 查询参数
       queryParams: {
         page: 1,
-        limit: 10
+        limit: 10,
+        departmentName: null
       },
       // 总条数
       total: 0,
-      // 表格数据
-      deptList: [],
       // 弹出框
       dialogVisible: false,
       // 弹出框标题
       title: '',
       // 弹出框表单
       form: {
-        parentId: 0
+        parentId: 0,
+        departmentName: null,
+        departmentDescribe: null,
+        departmentNum: null
       },
       // 部门树数据
       options: [],
@@ -199,9 +191,8 @@ export default {
       getDeptList(this.queryParams).then(res => {
         if (res.code === 200) {
           const data = res.data
-          this.deptList = data.departmentList
+          this.mulData = data.departmentList
           this.total = data.count
-          this.getOptionsList()
           this.loading = false
         }
       })
@@ -229,6 +220,7 @@ export default {
     handelAdd() {
       this.dialogVisible = true
       this.title = '添加部门'
+      this.getOptionsList()
       this.reset()
     },
     /** 修改按钮 */
@@ -239,11 +231,12 @@ export default {
       })
       this.dialogVisible = true
       this.title = '修改部门'
+      this.getOptionsList()
     },
     /** 表格多选 */
-    handleSelectionChange(val) {
-      this.depts = val
-      this.multiple = !val.length
+    selectChange(selection) {
+      this.depts = selection
+      this.multiple = !selection.length
     },
     /** 删除按钮 */
     handelDel(row) {
@@ -260,7 +253,7 @@ export default {
             message: '删除失败,请先删除下级部门'
           })
         } else {
-          if (this.deptList.length === 1) {
+          if (this.mulData.length === 1) {
             this.queryParams.page -= 1
           }
           delDept([row.id]).then(res => {
@@ -300,7 +293,7 @@ export default {
               throw Error()
             } else {
               const ids = this.depts.map(item => item.id)
-              if (ids.length === this.deptList.length) {
+              if (ids.length === this.mulData.length) {
                 this.queryParams.page -= 1
               }
               delDept(ids).then(res => {
@@ -318,7 +311,6 @@ export default {
           console.log(error)
         }
       }).catch(() => {
-        this.$refs.deptTable.clearSelection()
         this.$message({
           type: 'info',
           message: '已取消删除'
@@ -342,6 +334,13 @@ export default {
             })
           } else {
             this.form.id = this.id
+            if (this.form.id === this.form.parentId) {
+              this.$message({
+                message: '不可选择与自身相同的上级部门',
+                type: 'warning'
+              })
+              return
+            }
             editDept(this.form).then(res => {
               if (res.code === 200) {
                 this.$message({

+ 39 - 27
chuanyi-admin/src/views/system/dict/dict-detail.vue

@@ -4,11 +4,11 @@
       <el-col :span="24">
         <!-- 表单查询 -->
         <el-form ref="queryForm" :model="queryParams" :inline="true" size="small">
-          <el-form-item label="字典名称" prop="dictValue">
-            <el-input v-model="queryParams.dictValue" placeholder="请输入字典名称" clear />
+          <el-form-item label="字典名称" prop="dictKey">
+            <el-input v-model="queryParams.dictKey" placeholder="请输入字典名称" clear />
           </el-form-item>
-          <el-form-item label="字典值" prop="dictKey">
-            <el-input v-model="queryParams.dictKey" placeholder="请输入字典值" clear />
+          <el-form-item label="字典值" prop="dictValue">
+            <el-input v-model="queryParams.dictValue" placeholder="请输入字典值" clear />
           </el-form-item>
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" size="mini" @click="handelSearch">搜索</el-button>
@@ -39,19 +39,20 @@
 
         <!-- 表格数据信息 -->
         <el-table
-          v-loading="loading"
-          :data="dictList"
+          ref="table"
+          :data="mulData"
           row-key="id"
           border
-          stripe
           header-row-class-name="headBackground"
-          @selection-change="handleSelectionChange"
+          @select="select"
+          @select-all="selectAll"
+          @selection-change="selectChange"
         >
-          <el-table-column type="selection" width="50" align="center" />
-          <el-table-column key="dictKey" label="字典名称" align="center" prop="dictKey" />
-          <el-table-column key="dictValue" label="字典值" align="center" prop="dictValue" />
-          <el-table-column key="sortNum" label="排序号" align="center" prop="sortNum" />
-          <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width">
+          <el-table-column type="selection" align="center" />
+          <el-table-column label="字典名称" prop="dictKey" show-overflow-tooltip header-align="center" />
+          <el-table-column label="字典值" prop="dictValue" show-overflow-tooltip align="center" />
+          <el-table-column label="排序号" prop="sortNum" show-overflow- align="center" />
+          <el-table-column label="操作" align="center">
             <template slot-scope="scope">
               <el-button size="mini" type="text" icon="el-icon-edit" @click="handelEdit(scope.row)">修改
               </el-button>
@@ -124,10 +125,12 @@
 </template>
 
 <script>
-import { delDict, addDict, getPageDictList, editDict, getDictListByType } from '@/api/system/dict.js'
+import { delDict, addDict, getPageDictList, editDict, getDictListByType, getDictDetail } from '@/api/system/dict.js'
 import selectTree from '@/components/SelectTree'
+import multiple from '@/views/system/mixins/multiple'
 export default {
   components: { selectTree },
+  mixins: [multiple],
   data() {
     const sortNumRule = (rule, value, callback) => {
       var reg = /^[1-9][0-9]*$/
@@ -145,29 +148,34 @@ export default {
       // 查询参数
       queryParams: {
         page: 1,
-        num: 10
+        num: 10,
+        dictValue: null,
+        dictKey: null
       },
       // 总条数
       total: 0,
       // 表格数据
-      dictList: [],
+      mulData: [],
       // 弹出框
       dialogVisible: false,
       // 弹出框标题
       title: '',
       // 弹出框表单
       form: {
-        parentId: 0
+        parentId: 0,
+        dictValue: null,
+        dictKey: null,
+        sortNum: null
       },
       // 字典树数据
       options: [],
       // 表单验证
       rules: {
         dictValue: [
-          { required: true, message: '字典名称不能为空', trigger: 'blur' }
+          { required: true, message: '字典不能为空', trigger: 'blur' }
         ],
         dictKey: [
-          { required: true, message: '字典不能为空', trigger: 'blur' }
+          { required: true, message: '字典名称不能为空', trigger: 'blur' }
         ],
         sortNum: [
           { required: true, trigger: 'blur', validator: sortNumRule }
@@ -195,12 +203,12 @@ export default {
     getPageDictList() {
       getPageDictList(this.queryParams).then(res => {
         if (res.code === 200 & res.data === null) {
-          this.dictList = []
+          this.mulData = []
           this.total = 0
           return
         }
         const data = res.data
-        this.dictList = data.dictPage
+        this.mulData = data.dictPage
         this.total = data.count
         this.getDictListByType()
       })
@@ -232,14 +240,18 @@ export default {
     },
     /** 修改按钮 */
     handelEdit(row) {
-      this.form = JSON.parse(JSON.stringify(row))
+      getDictDetail({ dictId: row.id }).then(res => {
+        if (res.code === 200) {
+          this.form = res.data
+        }
+      })
       this.dialogVisible = true
       this.title = '修改字典'
     },
     /** 表格多选 */
-    handleSelectionChange(val) {
-      this.ids = val.map(item => item.id)
-      this.multiple = !val.length
+    selectChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.multiple = !selection.length
     },
     /** 删除按钮 */
     handelDel(id) {
@@ -249,7 +261,7 @@ export default {
         cancelButtonClass: 'btn_custom_cancel',
         type: 'warning'
       }).then(() => {
-        if (this.dictList.length === 1) {
+        if (this.mulData.length === 1) {
           this.queryParams.page -= 1
         }
         this.ids.push(id)
@@ -269,7 +281,7 @@ export default {
         cancelButtonClass: 'btn_custom_cancel',
         type: 'warning'
       }).then(() => {
-        if (this.ids.length === this.dictList.length) {
+        if (this.ids.length === this.mulData.length) {
           this.queryParams.page -= 1
         }
         this.delDictType()

+ 14 - 4
chuanyi-admin/src/views/system/dict/index.vue

@@ -46,7 +46,8 @@
           <el-table-column key="dictKeyType" label="字典类型" align="center" prop="dictKeyType" />
           <el-table-column key="dictKeyValue" label="字典值" align="center" prop="dictKeyValue">
             <template slot-scope="scope">
-              <el-link type="primary" @click="hendelTo(scope.row)">{{ scope.row.dictKeyValue }}</el-link>
+              <el-link type="primary" :underline="false" @click="hendelTo(scope.row)">{{ scope.row.dictKeyValue
+              }}</el-link>
             </template>
           </el-table-column>
           <el-table-column key="sortNum" label="排序号" align="center" prop="sortNum" />
@@ -109,7 +110,7 @@
 </template>
 
 <script>
-import { getAllDictType, editDictType, addDictType, delDictType } from '@/api/system/dictType.js'
+import { getAllDictType, editDictType, addDictType, delDictType, getDictTypeDetail } from '@/api/system/dictType.js'
 export default {
   data() {
     const sortNumRule = (rule, value, callback) => {
@@ -141,7 +142,12 @@ export default {
       // 弹出框标题
       title: '',
       // 弹出框表单
-      form: {},
+      form: {
+        description: null,
+        dictKeyType: null,
+        dictKeyValue: null,
+        sortNum: null
+      },
       // 字典树数据
       options: [],
       // 表单验证
@@ -205,7 +211,11 @@ export default {
     },
     /** 修改按钮 */
     handelEdit(row) {
-      this.form = JSON.parse(JSON.stringify(row))
+      getDictTypeDetail({ dictTypeId: row.id }).then(res => {
+        if (res.code === 200) {
+          this.form = res.data
+        }
+      })
       this.dialogVisible = true
       this.title = '修改字典'
     },

+ 3 - 1
chuanyi-admin/src/views/system/log/index.vue

@@ -101,6 +101,8 @@ export default {
       queryParams: {
         page: 1,
         limit: 10,
+        modelName: null,
+        userId: null,
         // 选中时间
         changeTime: null
       },
@@ -149,7 +151,7 @@ export default {
           if (res.code === 200) {
             this.$message({
               type: 'success',
-              message: '删除成功!'
+              message: '清空成功!'
             })
           }
         })

+ 42 - 15
chuanyi-admin/src/views/system/menu/index.vue

@@ -31,13 +31,26 @@
           stripe
           header-row-class-name="headBackground"
         >
-          <el-table-column type="index" width="50" label="序号" align="center" />
-          <el-table-column key="menuName" label="菜单名称" align="center" prop="menuName" />
-          <el-table-column key="menuIcon" label="菜单图标" align="center" prop="menuIcon" />
-          <el-table-column key="menuUrl" label="路由地址" align="center" prop="menuUrl" />
-          <el-table-column key="sortNum" label="排序号" align="center" prop="sortNum" />
-          <el-table-column key="createTime" label="创建时间" align="center" prop="createTime" width="160" />
-          <el-table-column key="updateTime" label="更新时间" align="center" prop="updateTime" width="160">
+          <el-table-column key="menuName" label="菜单名称" header-align="center" prop="menuName" show-overflow-tooltip />
+          <el-table-column key="menuIcon" label="菜单图标" prop="menuIcon" align="center" show-overflow-tooltip />
+          <el-table-column key="menuUrl" label="路由地址" prop="menuUrl" align="center" show-overflow-tooltip />
+          <el-table-column key="sortNum" label="排序号" prop="sortNum" align="center" show-overflow-tooltip />
+          <el-table-column
+            key="createTime"
+            label="创建时间"
+            prop="createTime"
+            align="center"
+            width="160"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            key="updateTime"
+            label="更新时间"
+            prop="updateTime"
+            align="center"
+            width="160"
+            show-overflow-tooltip
+          >
             <template slot-scope="scope">
               {{ scope.row.updateTime === null ? scope.row.createTime : scope.row.updateTime }}
             </template>
@@ -48,7 +61,7 @@
               </el-button>
               <el-button size="mini" type="text" icon="el-icon-delete" @click="handelDel(scope.row.id)">删除
               </el-button>
-              <el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handelAuth(scope.row.id)">分配接口
+              <el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handelAuth(scope.row.id)">分配权限
               </el-button>
             </template>
           </el-table-column>
@@ -72,7 +85,7 @@
         <el-row>
           <el-col :span="24">
             <el-form-item label="上级菜单" prop="parentId">
-              <selectTree v-model="form.parentId" :options="menuList" placeholder="请选择上级菜单" key-name="menuName" />
+              <selectTree v-model="form.parentId" :options="options" placeholder="请选择上级菜单" key-name="menuName" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -145,7 +158,8 @@ export default {
       // 查询参数
       queryParams: {
         page: 1,
-        limit: 10
+        limit: 10,
+        menuName: null
       },
       // 总条数
       total: 0,
@@ -156,9 +170,14 @@ export default {
       // 弹出框标题
       title: '',
       // 弹出框表单
-      form: {},
-      // 菜单类别
-      // options: [],
+      form: {
+        parentId: null,
+        menuIcon: null,
+        menuName: null,
+        menuUrl: null
+      },
+      // 弹出框下拉框数据
+      options: [],
       // 表单验证
       rules: {
         menuName: [
@@ -189,7 +208,6 @@ export default {
         this.menuList = data.menuList
         this.loading = false
         this.total = data.count
-        this.getOptionsList()
       })
     },
     /** 获取上级菜单 */
@@ -200,7 +218,7 @@ export default {
       }).then(res => {
         if (res.code === 200) {
           const data = res.data
-          this.options = this.$utils.toArrayTree(data.menuList)
+          this.options = data.menuList
         }
       })
     },
@@ -220,6 +238,7 @@ export default {
       this.reset()
       this.dialogVisible = true
       this.title = '添加菜单'
+      this.getOptionsList()
     },
     /** 修改按钮 */
     handelEdit(id) {
@@ -228,6 +247,7 @@ export default {
       detailtMenuList({ id }).then(res => {
         this.form = res.data
       })
+      this.getOptionsList()
       this.title = '修改菜单'
     },
     /** 删除按钮 */
@@ -273,6 +293,13 @@ export default {
             })
           } else {
             this.form.id = this.id
+            if (this.form.id === this.form.parentId) {
+              this.$message({
+                message: '不能选择自身为上级菜单',
+                type: 'warning'
+              })
+              return
+            }
             editMenuList(this.form).then(res => {
               if (res.code === 200) {
                 this.$message({

+ 8 - 9
chuanyi-admin/src/views/system/menu/menu-auth.vue

@@ -29,9 +29,8 @@
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="接口名称" prop="permissionUrl" :show-overflow-tooltip="true" align="center" />
-      <el-table-column label="备注" prop="permissionName" :show-overflow-tooltip="true" align="center" />
-      <el-table-column label="来源" prop="menuName" :show-overflow-tooltip="true" align="center" />
+      <el-table-column label="权限名称" prop="permissionName" :show-overflow-tooltip="true" align="center" />
+      <el-table-column label="权限路径" prop="permissionUrl" :show-overflow-tooltip="true" align="center" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -60,7 +59,7 @@
 </template>
 
 <script>
-import { getTreeMenuList, delMenuAuth } from '@/api/system/menu'
+import { delMenuAuth, getMenuAuthList } from '@/api/system/menu'
 import menuDist from './menu-dist.vue'
 export default {
   name: 'MenuAuth',
@@ -81,7 +80,7 @@ export default {
       queryParams: {
         page: 1,
         num: 10,
-        id: null
+        menuId: null
       },
       // 取消分配菜单权限参数
       delMenuAuthObj: {
@@ -93,15 +92,15 @@ export default {
   created() {
     const userId = this.$route.params.userId
     if (userId) {
-      this.queryParams.id = userId
+      this.queryParams.menuId = userId
       this.getTreeMenuList()
     }
     this.delMenuAuthObj.permissionList = []
   },
   methods: {
-    /** 获取父级及自己所有菜单权限接口 */
+    /** 查询已有菜单权限列表 */
     getTreeMenuList() {
-      getTreeMenuList(this.queryParams).then(res => {
+      getMenuAuthList(this.queryParams).then(res => {
         const data = res.data
         this.authList = data.permissionList
         this.total = data.count
@@ -164,7 +163,7 @@ export default {
     /** 取消分配菜单权限接口 */
     delMenuAuth() {
       this.queryParams.page = 1
-      this.delMenuAuthObj.id = this.queryParams.id
+      this.delMenuAuthObj.id = this.$route.params.userId
       delMenuAuth(this.delMenuAuthObj).then(res => {
         if (res.code === 200) {
           this.getTreeMenuList()

+ 6 - 4
chuanyi-admin/src/views/system/menu/menu-dist.vue

@@ -57,14 +57,15 @@
 </template>
 
 <script>
-import { getAllAuthApi, distMenuAuth } from '@/api/system/menu'
+import { distMenuAuth, getNotMenuAuthList } from '@/api/system/menu'
 export default {
   data() {
     return {
       // 所有权限接口查询参数
       allAuthQuery: {
         page: 1,
-        limit: 10
+        num: 10,
+        menuId: null
       },
       // 分配菜单权限参数
       menuAuthObj: {
@@ -85,13 +86,14 @@ export default {
   },
   created() {
     if (this.$route.params.userId) {
+      this.allAuthQuery.menuId = this.$route.params.userId
       this.menuAuthObj.id = this.$route.params.userId
     }
   },
   methods: {
-    /** 查看所有权限接口 */
+    /** 查看未有权限接口列表 */
     getAllAuthApi() {
-      getAllAuthApi(this.allAuthQuery).then(res => {
+      getNotMenuAuthList(this.allAuthQuery).then(res => {
         const data = res.data
         this.addMenuAuthList = data.permissionList
         this.addTotal = data.count

+ 63 - 0
chuanyi-admin/src/views/system/mixins/multiple.js

@@ -0,0 +1,63 @@
+export default {
+  data() {
+    return {
+      mulData: []
+    }
+  },
+  methods: {
+    /** 单选 */
+    select(selection, row) {
+      if (selection.some(el => { return row.id === el.id })) {
+        if (row.children) {
+          this.checkAllSon(row.children, true)
+        }
+      } else {
+        if (row.children) {
+          this.checkAllSon(row.children, false)
+        }
+      }
+    },
+    checkAllSon(row, type) {
+      row.forEach(el => {
+        this.toggleSelection(el, type)
+        if (el.children && el.children.length) {
+          this.checkAllSon(el.children, type)
+        }
+      })
+    },
+    /** 全选 */
+    selectAll(selection) {
+      // tabledata第一层只要有在selection里面就是全选
+      const isSelect = selection.some(el => {
+        const tableDataIds = this.mulData.map(j => j.id)
+        return tableDataIds.includes(el.id)
+      })
+      // tableDate第一层只要有不在selection里面就是全不选
+      const isCancel = !this.mulData.every(el => {
+        const selectIds = selection.map(j => j.id)
+        return selectIds.includes(el.id)
+      })
+      if (isSelect) {
+        this.checkAll(this.mulData, true)
+      }
+      if (isCancel) {
+        this.checkAll(this.mulData, false)
+      }
+    },
+    checkAll(data, bool) {
+      data.forEach(el => {
+        this.toggleSelection(el, bool)
+        if (el.children && el.children.length) {
+          this.checkAll(el.children, bool)
+        }
+      })
+    },
+    toggleSelection(row, select) {
+      if (row) {
+        this.$nextTick(() => {
+          this.$refs.table && this.$refs.table.toggleRowSelection(row, select)
+        })
+      }
+    }
+  }
+}

+ 77 - 0
chuanyi-admin/src/views/system/mixins/multipleCheck.js

@@ -0,0 +1,77 @@
+export default {
+  data() {
+    return {
+      mulData: []
+    }
+  },
+  methods: {
+    /** 单选 */
+    select(selection, row) {
+      if (selection.some(el => { return row.id === el.id })) {
+        if (row.children) {
+          this.checkAllSon(row.children, true)
+          this.checkParent(this.mulData, row)
+        }
+      } else {
+        if (row.children) {
+          this.checkAllSon(row.children, false)
+        }
+      }
+    },
+    checkAllSon(row, type) {
+      row.forEach(el => {
+        this.toggleSelection(el, type)
+        if (el.children && el.children.length) {
+          this.checkAllSon(el.children, type)
+        }
+      })
+    },
+    checkParent(data, row) {
+      data.forEach(item => {
+        if (item.id === row.parentId) {
+          this.toggleSelection(item, true)
+          if (item.children && item.children.length) {
+            this.checkParent(this.mulData, item)
+          }
+        }
+        if (item.children && item.children.length) {
+          this.checkParent(item.children, row)
+        }
+      })
+    },
+    /** 全选 */
+    selectAll(selection) {
+      // tabledata第一层只要有在selection里面就是全选
+      const isSelect = selection.some(el => {
+        const tableDataIds = this.mulData.map(j => j.id)
+        return tableDataIds.includes(el.id)
+      })
+      // tableDate第一层只要有不在selection里面就是全不选
+      const isCancel = !this.mulData.every(el => {
+        const selectIds = selection.map(j => j.id)
+        return selectIds.includes(el.id)
+      })
+      if (isSelect) {
+        this.checkAll(this.mulData, true)
+      }
+      if (isCancel) {
+        this.checkAll(this.mulData, false)
+      }
+    },
+    checkAll(data, bool) {
+      data.forEach(el => {
+        this.toggleSelection(el, bool)
+        if (el.children && el.children.length) {
+          this.checkAll(el.children, bool)
+        }
+      })
+    },
+    toggleSelection(row, select) {
+      if (row) {
+        this.$nextTick(() => {
+          this.$refs.table && this.$refs.table.toggleRowSelection(row, select)
+        })
+      }
+    }
+  }
+}

+ 7 - 4
chuanyi-admin/src/views/system/role/index.vue

@@ -156,7 +156,10 @@ export default {
       // 是否显示弹出层
       open: false,
       // 表单参数
-      form: {},
+      form: {
+        roleName: null,
+        roleCode: null
+      },
       // 表单校验
       rules: {
         roleName: [
@@ -256,7 +259,7 @@ export default {
         if (res.code === 200) {
           if (!res.data.count) {
             this.$message({
-              message: '该菜单被角色权限绑定,无法删除',
+              message: '该角色被菜单权限绑定,无法删除',
               type: 'warning'
             })
           } else {
@@ -283,12 +286,12 @@ export default {
     /** 分配角色人员 */
     handleAuthUser(row) {
       const roleId = row.id
-      this.$router.push('/system/role/user-auth/role/' + roleId)
+      this.$router.push('/system/role/role-auth/role/' + roleId)
     },
     /** 分配角色菜单 */
     handleAuthMenu(row) {
       const roleId = row.id
-      this.$router.push('/system/role/user-menu/role/' + roleId)
+      this.$router.push('/system/role/role-menu/role/' + roleId)
     },
     /** 新增按钮操作 */
     handleAdd() {

+ 4 - 4
chuanyi-admin/src/views/system/role/user-auth.vue → chuanyi-admin/src/views/system/role/role-auth.vue

@@ -76,16 +76,16 @@
       align="right"
       @pagination="getList"
     />
-    <select-user ref="select" :role-id="queryParams.roleId" @updateUserList="getList()" />
+    <select-role ref="select" :role-id="queryParams.roleId" @updateUserList="getList()" />
   </div>
 </template>
 
 <script>
-import selectUser from './user-select'
+import selectRole from './role-select'
 import { getUserListById, cancelRoleAuth, cancelAllRoleAuth } from '@/api/system/user'
 export default {
   name: 'UserAuth',
-  components: { selectUser },
+  components: { selectRole },
   data() {
     return {
       // 遮罩层
@@ -137,7 +137,7 @@ export default {
       //     result = e.name
       //   }
       // })
-      val === 0 ? result = '客户端用户' : result = '管理用户'
+      val === 0 ? result = '客户端用户' : result = '管理用户'
       return result
     },
     /** 查询授权用户列表 */

+ 164 - 0
chuanyi-admin/src/views/system/role/role-menu.vue

@@ -0,0 +1,164 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="10" class="mb8 czBtns">
+      <el-col :span="1.5">
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handelAdd">添加菜单权限</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete-solid"
+          size="mini"
+          :disabled="celDistribution"
+          @click="handleDelMenus"
+        >批量取消
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="warning" plain icon="el-icon-back" size="mini" @click="handleClose">返回</el-button>
+      </el-col>
+    </el-row>
+
+    <el-table
+      ref="table"
+      :data="mulData"
+      row-key="id"
+      border
+      header-row-class-name="headBackground"
+      :loading="loading"
+      @select="select"
+      @select-all="selectAll"
+      @selection-change="selectChange"
+    >
+      <el-table-column type="selection" align="center" />
+      <el-table-column label="菜单名称" prop="menuName" show-overflow-tooltip header-align="center" />
+      <el-table-column label="菜单图标" prop="menuIcon" show-overflow-tooltip align="center" />
+      <el-table-column label="菜单路径" prop="menuUrl" show-overflow- align="center" />
+      <el-table-column label="更新时间" prop="updateTime" show-overflow-tooltip align="center" />
+      <el-table-column label="创建时间" prop="createTime" show-overflow-tooltip align="center" />
+      <el-table-column label="操作" align="center">
+        <template slot-scope="scope">
+          <el-button type="text" size="mini" :disabled="!celDistribution" @click="delMenu(scope.row.id)"><i
+            class="el-icon-circle-close celBtn"
+          /><span>取消分配</span>
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <roleMenuSelect ref="select" @handelUpdate="getList" />
+  </div>
+</template>
+
+<script>
+import { getMenuListByRoleId, delDistributionMenu } from '@/api/system/role'
+import roleMenuSelect from './role-menuSelect.vue'
+import multiple from '@/views/system/mixins/multiple'
+export default {
+  name: 'UserMenu',
+  components: {
+    roleMenuSelect
+  },
+  mixins: [multiple],
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 角色ID
+      roleId: null,
+      // 取消分配菜单参数
+      delDistObj: {
+        id: this.$route.params.userId,
+        menuList: []
+      },
+      // 禁用取消分配
+      celDistribution: true,
+      selectFlag: false
+    }
+  },
+  created() {
+    this.roleId = this.$route.params.userId
+    this.getList()
+  },
+  methods: {
+    /** 查询用户拥有的菜单列表 */
+    getList() {
+      const roleList = []
+      roleList.push({ id: Number(this.$route.params.userId) })
+      getMenuListByRoleId({ roleList }).then(res => {
+        if (res.code === 200) {
+          const data = res.data
+          this.mulData = this.$utils.toArrayTree(data)
+          this.loading = false
+        }
+      })
+    },
+    /** 返回按钮 */
+    handleClose() {
+      this.$router.push('/system/role')
+    },
+    /** 添加菜单 */
+    handelAdd() {
+      this.$refs.select.show()
+    },
+    /** 取消分配菜单多选 */
+    selectChange(selection) {
+      this.delDistObj.menuList = selection.map(item => { return { id: item.id } })
+      this.celDistribution = !selection.length
+    },
+    /** 取消分配按钮 */
+    delMenu(id) {
+      this.delDistObj.menuList = []
+      this.$confirm('您确定要取消分配该菜单吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        cancelButtonClass: 'btn_custom_cancel',
+        type: 'warning'
+      }).then(() => {
+        this.delDistObj.menuList.push({ id })
+        this.delDistributionMenu()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消操作'
+        })
+      })
+    },
+    /** 批量取消分配菜单按钮 */
+    handleDelMenus() {
+      this.$confirm('您确定要批量取消选中的菜单吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        cancelButtonClass: 'btn_custom_cancel',
+        type: 'warning'
+      }).then(() => {
+        this.delDistributionMenu()
+      }).catch(() => {
+        this.$refs.roleTable.clearSelection()
+        this.$message({
+          type: 'info',
+          message: '已取消操作'
+        })
+      })
+    },
+    /** 取消分配菜单请求 */
+    delDistributionMenu() {
+      delDistributionMenu(this.delDistObj).then(res => {
+        if (res.code === 200) {
+          this.$message({
+            type: 'success',
+            message: '取消成功'
+          })
+          this.dialogVisible = false
+          this.getList()
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 170 - 0
chuanyi-admin/src/views/system/role/role-menuSelect.vue

@@ -0,0 +1,170 @@
+<template>
+  <!-- 授权用户 -->
+  <el-dialog title="添加菜单权限" :visible.sync="dialogVisible" :close-on-click-modal="false">
+    <el-row class="czBtns">
+      <el-col>
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" :disabled="distribution" @click="handleDel">
+          批量分配</el-button>
+      </el-col>
+    </el-row>
+
+    <el-table
+      ref="table"
+      :data="mulData"
+      :loading="distLoading"
+      row-key="id"
+      border
+      header-row-class-name="headBackground"
+      @select="select"
+      @select-all="selectAll"
+      @selection-change="selectChange"
+    >
+      <el-table-column type="selection" align="center" />
+      <el-table-column label="菜单名称" prop="menuName" show-overflow-tooltip header-align="center" width="200" />
+      <el-table-column label="菜单图标" prop="menuIcon" show-overflow-tooltip align="center" />
+      <el-table-column label="菜单路径" prop="menuUrl" show-overflow- align="center" />
+      <el-table-column label="更新时间" prop="updateTime" show-overflow-tooltip align="center" />
+      <el-table-column label="创建时间" prop="createTime" show-overflow-tooltip align="center" />
+      <el-table-column label="操作" align="center">
+        <template slot-scope="scope">
+          <el-button type="text" size="mini" :disabled="!distribution" @click="addMenu(scope.row.id, $event)"><i
+            class="el-icon-circle-close celBtn"
+          /><span>分配</span>
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-dialog>
+</template>
+
+<script>
+import { getMenuListTree, distributionMenu, getRoleMenuIds } from '@/api/system/role'
+import multipleCheck from '@/views/system/mixins/multipleCheck'
+export default {
+  mixins: [multipleCheck],
+  data() {
+    return {
+      // 弹出框
+      dialogVisible: false,
+      // 弹出框表格加载状态
+      distLoading: true,
+      // 分配菜单参数
+      distObj: {
+        id: this.$route.params.userId,
+        addMenuList: []
+      },
+      // 角色已有菜单id集合
+      roleMenuIds: [],
+      // 禁用分配
+      distribution: true,
+      selectFlag: false
+    }
+  },
+  created() {
+
+  },
+  methods: {
+    /** 显示弹框 */
+    show() {
+      this.dialogVisible = true
+      this.getRoleMenuIds()
+    },
+    /** 所有菜单树信息 */
+    getMenuListTree() {
+      getMenuListTree().then(res => {
+        const data = res.data
+        this.mulData = data
+        this.toggle(this.mulData)
+        this.distLoading = false
+      })
+    },
+    /** 查看角色已有菜单id集合 */
+    getRoleMenuIds() {
+      getRoleMenuIds({ roleId: this.distObj.id }).then(res => {
+        if (res.code === 200) {
+          const data = res.data
+          this.roleMenuIds = data
+          this.getMenuListTree()
+        }
+      })
+    },
+    /** 初始选中已有菜单 */
+    toggle(data) {
+      data.forEach(item => {
+        this.roleMenuIds.forEach(el => {
+          if (el === item.id) {
+            this.$nextTick(() => {
+              this.$refs.table && this.$refs.table.toggleRowSelection(item, true)
+              this.$refs.table && this.$refs.table.toggleRowExpansion(item, true)
+            })
+          }
+        })
+        if (item.children && item.children.length) {
+          this.toggle(item.children)
+        }
+      })
+    },
+    /** 分配菜单多选 */
+    selectChange(selection) {
+      this.distObj.menuList = selection.map(item => { return { id: item.id } })
+      this.distribution = !selection.length
+    },
+    /** 分配按钮 */
+    addMenu(id, event) {
+      this.$resetBtn(event)
+      this.distObj.menuList = []
+      this.$confirm('您确定要分配该菜单吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        cancelButtonClass: 'btn_custom_cancel',
+        type: 'warning'
+      }).then(() => {
+        this.distObj.menuList.push({ id })
+        this.distributionMenu()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消操作'
+        })
+      })
+    },
+    /** 批量分配菜单按钮 */
+    handleDel(event) {
+      this.$resetBtn(event)
+      this.$confirm('您确定要批量分配选中的菜单吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        cancelButtonClass: 'btn_custom_cancel',
+        type: 'warning'
+      }).then(() => {
+        this.distributionMenu()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消操作'
+        })
+      })
+    },
+    /** 分配菜单请求 */
+    distributionMenu() {
+      distributionMenu(this.distObj).then(res => {
+        if (res.code === 200) {
+          this.$message({
+            type: 'success',
+            message: '分配菜单成功'
+          })
+          this.dialogVisible = false
+          this.$emit('handelUpdate')
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.el-dialog {
+  height: 78vh;
+  overflow: auto;
+}
+</style>

+ 0 - 0
chuanyi-admin/src/views/system/role/user-select.vue → chuanyi-admin/src/views/system/role/role-select.vue


+ 0 - 394
chuanyi-admin/src/views/system/role/user-menu.vue

@@ -1,394 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-row :gutter="10" class="mb8 czBtns">
-      <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handelAdd">添加菜单</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete-solid"
-          size="mini"
-          :disabled="celDistribution"
-          @click="handleDelMenus"
-        >批量取消
-        </el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-back" size="mini" @click="handleClose">返回</el-button>
-      </el-col>
-    </el-row>
-
-    <el-table
-      ref="roleTable"
-      v-loading="loading"
-      :data="menuList"
-      row-key="id"
-      border
-      stripe
-      header-row-class-name="headBackground"
-      @selection-change="handelDelDist"
-    >
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="菜单名称" prop="menuName" :show-overflow-tooltip="true" />
-      <el-table-column label="菜单图标" prop="menuIcon" :show-overflow-tooltip="true" />
-      <el-table-column label="菜单路径" prop="menuUrl" :show-overflow-tooltip="true" />
-      <el-table-column label="更新时间" prop="updateTime" :show-overflow-tooltip="true" />
-      <el-table-column label="创建时间" prop="createTime" :show-overflow-tooltip="true" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button type="text" size="mini" :disabled="!celDistribution" @click="delMenu(scope.row.id)"><i
-            class="el-icon-circle-close celBtn"
-          /><span>取消分配</span>
-          </el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <el-dialog title="分配菜单" :visible.sync="dialogVisible" width="800px" :close-on-click-modal="false">
-      <el-row class="czBtns">
-        <el-col>
-          <el-button type="primary" plain icon="el-icon-plus" size="mini" :disabled="distribution" @click="handleDel">
-            批量分配</el-button>
-        </el-col>
-      </el-row>
-      <el-table
-        ref="distTable"
-        v-loading="distLoading"
-        :data="addMenuList"
-        row-key="id"
-        border
-        stripe
-        header-row-class-name="headBackground"
-        @selection-change="handelAddDist"
-        @select="select"
-        @select-all="selectAll"
-      >
-        <el-table-column type="selection" width="55" align="center" />
-        <el-table-column label="菜单名称" prop="menuName" :show-overflow-tooltip="true" />
-        <el-table-column label="菜单图标" prop="menuIcon" :show-overflow-tooltip="true" />
-        <el-table-column label="菜单路径" prop="menuUrl" :show-overflow-tooltip="true" />
-        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-          <template slot-scope="scope">
-            <el-button
-              type="primary"
-              plain
-              icon="el-icon-circle-plus"
-              size="mini"
-              :disabled="!distribution"
-              @click="addMenu(scope.row.id, $event)"
-            >分配菜单
-            </el-button>
-          </template>
-        </el-table-column>
-      </el-table>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import { getMenuListByRoleId, getMenuListTree, distributionMenu, delDistributionMenu } from '@/api/system/role'
-export default {
-  name: 'UserMenu',
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 弹出框表格加载状态
-      distLoading: true,
-      // 分配菜单参数
-      distObj: {
-        id: this.$route.params.userId,
-        menuList: []
-      },
-      // 取消分配菜单参数
-      delDistObj: {
-        id: this.$route.params.userId,
-        menuList: []
-      },
-      // 用户表格数据
-      menuList: [],
-      // 禁用取消分配
-      celDistribution: true,
-      // 弹出框
-      dialogVisible: false,
-      // 分配菜单表格
-      addMenuList: [],
-      // 禁用分配
-      distribution: true,
-      // 全选按钮选中所有节点
-      isSelectAll: false
-    }
-  },
-  created() {
-    this.getList()
-  },
-  methods: {
-    /** 查询用户拥有的菜单列表 */
-    getList() {
-      const roleList = []
-      roleList.push({ id: Number(this.$route.params.userId) })
-      getMenuListByRoleId({ roleList }).then(res => {
-        if (res.code === 200) {
-          const data = res.data
-          this.menuList = this.$utils.toArrayTree(data)
-          this.loading = false
-        }
-      })
-    },
-    /** 所有菜单树信息 */
-    getMenuListTree() {
-      getMenuListTree().then(res => {
-        const data = res.data
-        data.forEach(item => {
-          item.isSelect = false
-        })
-        this.addMenuList = data
-        this.distLoading = false
-      })
-    },
-    /** 返回按钮 */
-    handleClose() {
-      this.$router.push('/system/role')
-    },
-    /** 添加菜单 */
-    handelAdd() {
-      this.dialogVisible = true
-      this.getMenuListTree()
-    },
-    /** 分配菜单多选 */
-    handelAddDist(selection) {
-      this.distObj.menuList = selection.map(item => { return { id: item.id } })
-      this.distribution = !selection.length
-    },
-    /** 取消分配菜单多选 */
-    handelDelDist(selection) {
-      this.delDistObj.menuList = selection.map(item => { return { id: item.id } })
-      this.celDistribution = !selection.length
-    },
-    /** 分配按钮 */
-    addMenu(id, event) {
-      this.$resetBtn(event)
-      this.distObj.menuList = []
-      this.$confirm('您确定要分配该菜单吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        cancelButtonClass: 'btn_custom_cancel',
-        type: 'warning'
-      }).then(() => {
-        this.distObj.menuList.push({ id })
-        this.distributionMenu()
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消操作'
-        })
-      })
-    },
-    /** 批量分配菜单按钮 */
-    handleDel(event) {
-      this.$resetBtn(event)
-      this.$confirm('您确定要批量分配选中的菜单吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        cancelButtonClass: 'btn_custom_cancel',
-        type: 'warning'
-      }).then(() => {
-        this.distributionMenu()
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消操作'
-        })
-      })
-    },
-    /** 取消分配按钮 */
-    delMenu(id) {
-      this.delDistObj.menuList = []
-      this.$confirm('您确定要取消分配该菜单吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        cancelButtonClass: 'btn_custom_cancel',
-        type: 'warning'
-      }).then(() => {
-        this.delDistObj.menuList.push({ id })
-        this.delDistributionMenu()
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消操作'
-        })
-      })
-    },
-    /** 批量取消分配菜单按钮 */
-    handleDelMenus() {
-      this.$confirm('您确定要批量取消选中的菜单吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        cancelButtonClass: 'btn_custom_cancel',
-        type: 'warning'
-      }).then(() => {
-        this.delDistributionMenu()
-      }).catch(() => {
-        this.$refs.roleTable.clearSelection()
-        this.$message({
-          type: 'info',
-          message: '已取消操作'
-        })
-      })
-    },
-    /** 分配菜单请求 */
-    distributionMenu() {
-      distributionMenu(this.distObj).then(res => {
-        if (res.code === 200) {
-          this.$message({
-            type: 'success',
-            message: res.data
-          })
-          this.dialogVisible = false
-          this.getList()
-        }
-      })
-    },
-    /** 取消分配菜单请求 */
-    delDistributionMenu() {
-      delDistributionMenu(this.delDistObj).then(res => {
-        if (res.code === 200) {
-          this.$message({
-            type: 'success',
-            message: '取消成功'
-          })
-          this.dialogVisible = false
-          this.getList()
-        }
-      })
-    },
-    // 选中父节点时,子节点一起选中取消
-    select(selection, row) {
-      // 选中
-      if (
-        selection.some((el) => {
-          return row.id === el.id
-        })
-      ) {
-        // 选中行有children
-        if (row.children.length) {
-          // 全选children
-          this.setChildren(row.children, true)
-        } else {
-          this.findParentNode(this.addMenuList, selection, row)
-        }
-      } else {
-        // 反选
-        // 子节点有children全选中
-        if (row.children.length) {
-          this.setChildren(row.children, false)
-        } else {
-          // 反选子节点反选父节点
-          const parentRow = selection.find(item => {
-            return item.id === row.parentId
-          })
-          this.$nextTick(() => {
-            this.$refs.distTable.toggleRowSelection(parentRow, false)
-          })
-        }
-      }
-    },
-    findParentNode(data, selection, row) {
-      for (let i = 0; i < data.length; i++) {
-        this.setParentCheck(data[i], selection, row)
-        if (data[i].children) {
-          this.findParentNode(data[i].children, selection, row)
-        }
-      }
-    },
-    setParentCheck(item, selection, row) {
-      if (item.id === row.parentId) {
-        const selectIds = selection.filter(o => {
-          return item.id === o.parentId
-        })
-        if (item.children.length === 1) {
-          this.recursion(this.addMenuList, item)
-          return
-        }
-        item.children.forEach(j => {
-          selectIds.forEach(q => {
-            if (j.id === q.id) {
-              if (selectIds.length === item.children.length) {
-                this.$nextTick(() => {
-                  this.$refs.distTable.toggleRowSelection(item, true)
-                })
-              }
-            }
-          })
-        })
-      }
-    },
-    recursion(data, item) {
-      for (let i = 0; i < data.length; i++) {
-        if (item) {
-          if (data[i].id === item.parentId) {
-            this.$nextTick(() => {
-              this.$refs.distTable.toggleRowSelection(data[i], true)
-              this.$refs.distTable.toggleRowSelection(item, true)
-            })
-          }
-        }
-        if (data[i].children) {
-          this.recursion(data[i].children)
-        }
-      }
-    },
-    // 选择全部
-    selectAll(selection) {
-      // addMenuList第一层只要有在selection里面就是全选
-      const isSelect = selection.some((el) => {
-        const tableDataIds = this.addMenuList.map((j) => j.id)
-        return tableDataIds.includes(el.id)
-      })
-      // addMenuList第一层只要有不在selection里面就是全不选
-      const isCancel = !this.addMenuList.every((el) => {
-        const selectIds = selection.map((j) => j.id)
-        return selectIds.includes(el.id)
-      })
-      if (isSelect) {
-        selection.map((el) => {
-          if (el.children) {
-            // 解决子节点没有被勾选到
-            this.setChildren(el.children, true)
-          }
-        })
-      }
-      if (isCancel) {
-        this.addMenuList.map((el) => {
-          if (el.children) {
-            // 解决子节点没有被勾选到
-            this.setChildren(el.children, false)
-          }
-        })
-      }
-    },
-    setChildren(children, type) {
-      // 编辑多个子节点
-      children.map((j) => {
-        this.toggleSelection(j, type)
-        if (j.children) {
-          this.setChildren(j.children, type)
-        }
-      })
-    },
-    toggleSelection(row, select) {
-      if (row) {
-        this.$nextTick(() => {
-          this.$refs.distTable.toggleRowSelection(row, select)
-        })
-      }
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-
-</style>

+ 31 - 10
chuanyi-admin/src/views/system/user/index.vue

@@ -108,26 +108,37 @@
     <el-dialog
       :title="title"
       :visible.sync="open"
-      width="600px"
+      width="500px"
       style="margin-top:15vh"
       append-to-body
       :close-on-click-modal="false"
     >
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-row>
-          <el-col :span="12">
+        <el-row style="margin-bottom:10px">
+          <el-col>
             <el-form-item label="用户名称" prop="userName">
               <el-input
                 v-if="form.userId == undefined"
                 v-model="form.userName"
                 placeholder="请输入用户名称"
                 maxlength="20"
+                style="width:300px"
+                minlength="2"
+              />
+              <el-input
+                v-else
+                v-model="form.userName"
+                placeholder="请输入用户名称"
+                maxlength="20"
                 minlength="2"
+                disabled
+                style="width:300px"
               />
-              <el-input v-else v-model="form.userName" placeholder="请输入用户名称" maxlength="20" minlength="2" readonly />
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+        </el-row>
+        <el-row style="margin-bottom:10px">
+          <el-col>
             <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
               <el-input
                 ref="password"
@@ -136,6 +147,7 @@
                 :type="passwordType"
                 maxlength="20"
                 auto-complete="new-password"
+                style="width:300px"
               />
               <span class="show-pwd" @click="showPwd">
                 <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
@@ -144,14 +156,14 @@
           </el-col>
         </el-row>
         <el-row>
-          <el-col :span="12">
+          <el-col>
             <el-form-item label="用户类型" prop="userType">
               <el-select v-model="form.userType" placeholder="请选择用户类型">
                 <el-option v-for="dict in userType" :key="dict.value" :label="dict.name" :value="dict.value" />
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <el-col>
             <el-form-item v-if="form.userId != undefined" label="用户状态">
               <el-radio-group v-model="form.state">
                 <el-radio v-for="dict in userStatus" :key="dict.value" :label="dict.value">{{ dict.name }}</el-radio>
@@ -208,7 +220,12 @@ export default {
       // 是否显示弹出层
       open: false,
       // 表单参数
-      form: {},
+      form: {
+        userName: null,
+        password: null,
+        userType: null,
+        state: null
+      },
       // 管理员默认ID
       defaultAdminId: '1',
       // 用户状态
@@ -345,6 +362,10 @@ export default {
             delUserById({
               'userId': id
             }).then(response => {
+              this.$message({
+                message: '删除成功',
+                type: 'success'
+              })
               this.getUserList()
             })
           }
@@ -439,6 +460,7 @@ export default {
       this.reset()
       this.form.userType = this.userType[0].value
       this.open = true
+      this.passwordType = 'password'
       this.title = '添加用户'
     },
     /** 表单提交 */
@@ -505,12 +527,11 @@ export default {
 <style rel="stylesheet/scss" lang="scss">
 .show-pwd {
   position: absolute;
-  right: 10px;
+  right: 90px;
   top: 1px;
   font-size: 16px;
   color: #889aa4;
   cursor: pointer;
   user-select: none;
 }
-
 </style>

+ 6 - 0
chuanyi_server/pom.xml

@@ -164,6 +164,12 @@
             <version>0.6.3</version>
         </dependency>
         <!--opcUa读取依赖-->
+
+        <!--Test依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 0 - 23
chuanyi_server/src/main/java/com/judong/chuanyiserver/config/KepOpcServerTimerTask.java

@@ -1,23 +0,0 @@
-package com.judong.chuanyiserver.config;
-
-import com.judong.chuanyiserver.entity.ChannelSetting;
-import com.judong.chuanyiserver.entity.ServerInformation;
-
-import java.util.List;
-import java.util.TimerTask;
-
-public class KepOpcServerTimerTask extends TimerTask {
-
-    public ServerInformation serverInformation;
-    public List<ChannelSetting> channelSettingList;
-
-    public KepOpcServerTimerTask(ServerInformation serverInformation, List<ChannelSetting> channelSettingList) {
-        this.serverInformation = serverInformation;
-        this.channelSettingList = channelSettingList;
-    }
-
-    @Override
-    public void run() {
-        System.out.println("----");
-    }
-}

+ 29 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/config/MessageReceiver.java

@@ -0,0 +1,29 @@
+package com.judong.chuanyiserver.config;
+
+import com.judong.chuanyiserver.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.connection.Message;
+import org.springframework.data.redis.connection.MessageListener;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class MessageReceiver implements MessageListener {
+
+    private static Logger logger = LoggerFactory.getLogger(MessageReceiver.class);
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+    @Override
+    public void onMessage(Message message, byte[] pattern) {
+        logger.info("channel:" + new String(pattern));
+        Result result = (Result) redisTemplate.getValueSerializer().deserialize(message.getBody());
+        System.out.println("接收到的消息是:" + result);
+        logger.info("Received <" + result + ">");
+    }
+}

+ 65 - 67
chuanyi_server/src/main/java/com/judong/chuanyiserver/config/OpcAsyncTask.java

@@ -4,14 +4,21 @@ import com.judong.chuanyiserver.dao.DataSourceDao;
 import com.judong.chuanyiserver.dao.ItemGroupDao;
 import com.judong.chuanyiserver.dao.RawDataDao;
 import com.judong.chuanyiserver.entity.*;
+import com.judong.chuanyiserver.enums.DataSourceTypeEnum;
 import com.judong.chuanyiserver.enums.ResultEnum;
 import com.judong.chuanyiserver.exception.CustomException;
+import com.judong.chuanyiserver.task.KepServerTimerTask;
+import com.judong.chuanyiserver.task.OpcUaTimerTask;
 import com.judong.chuanyiserver.util.*;
 import lombok.extern.slf4j.Slf4j;
-import lombok.val;
 import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
 import org.eclipse.milo.opcua.stack.core.types.builtin.*;
+import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger;
 import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn;
+import org.eclipse.milo.opcua.stack.core.types.structured.HistoryReadResponse;
+import org.eclipse.milo.opcua.stack.core.types.structured.HistoryReadResult;
+import org.eclipse.milo.opcua.stack.core.types.structured.HistoryReadValueId;
+import org.eclipse.milo.opcua.stack.core.types.structured.ReadRawModifiedDetails;
 import org.openscada.opc.dcom.da.OPCSERVERSTATE;
 import org.openscada.opc.lib.da.Item;
 import org.openscada.opc.lib.da.*;
@@ -22,13 +29,12 @@ import org.springframework.stereotype.Component;
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Future;
 
 import static com.judong.chuanyiserver.util.KepOpcServerUtil.getVal;
 
 @Component
-@Async("asyncThreadPoolTaskExecutor")
+@Async("threadPoolTaskExecutor")
 @Slf4j
 public class OpcAsyncTask {
 
@@ -54,61 +60,23 @@ public class OpcAsyncTask {
         log.info("异步任务B在执行,时间是:" + System.currentTimeMillis());
     }
 
-    public Future<String> testC(String xx) {
-        return new AsyncResult(xx);
-    }
-
-    public void KepServerReadItemList(ServerInformation serverInformation, List<ChannelSetting> channelSettingList) {
-        log.info("KepServer:" + serverInformation.getIpAddress() + "开始读取数据");
-        try {
-            String opcServerDaPoolKey = KepOpcServerUtil.generateOpcPoolKey(serverInformation);
-            if (KepOpcServerUtil.validationKey(opcServerDaPoolKey)) {
-                Server server = KepOpcServerUtil.getServer(opcServerDaPoolKey);
-                if (null == server.getServerState()) {
-                    throw new CustomException(ResultEnum.NOT_FOUND.getRespCode(), "连接失败");
-                }
-                if (OPCSERVERSTATE.OPC_STATUS_RUNNING == server.getServerState().getServerState()) {
-                    Group group = server.addGroup();
-                    group.addItems();
-                    //循环读值需要使用到的
-                    final AccessBase access = new SyncAccess(server, 1000);
-                    //开始读值
-                    access.bind();
-                    //停止读值
-                    access.unbind();
-                    Iterator<ChannelSetting> iterator = channelSettingList.iterator();
-                    while (iterator.hasNext()) {
-                        Item item = group.addItem(iterator.next().getChannelName());
-                        Map<String, Object> value = getVal(item.read(true).getValue());
-                        System.err.println(iterator.next().getChannelName() + ":" + value);
-                    }
-                    KepOpcServerUtil.returnServer(opcServerDaPoolKey, server);
-                }
-            }
-        } catch (Exception e) {
-            throw new CustomException(ResultEnum.REQUEST_TIME_OUT.getRespCode(), e.getMessage());
-        }
-    }
-
-    public void KepServerCloseReadItemList(ServerInformation serverInformation, List<ChannelSetting> channelSettingList) {
-        log.info("KepServer:" + serverInformation.getIpAddress() + "停止读取数据");
+    public void testXXX() {
+        Timer timer = new Timer();
+        timer.schedule(new OpcUaTimerTask(), 1000, 2000);
     }
 
-    public void OpcServerUaReadItemList(ServerInformation serverInformation, List<ChannelSetting> channelSettingList) {
-        log.info("OpcServerUa:opc.tcp://" + serverInformation.getIpAddress() + ":" + serverInformation.getIpPort() + "开始读取数据");
-    }
-
-    public void OpcServerUaCloseReadItemList(ServerInformation serverInformation, List<ChannelSetting> channelSettingList) {
-        log.info("OpcServerUa:opc.tcp://" + serverInformation.getIpAddress() + ":" + serverInformation.getIpPort() + "停止读取数据");
+    public Future<String> testC(String xx) {
+        return new AsyncResult(xx);
     }
 
     //异步读取kepserver
     public void runKepServer(ItemGroup itemGroup, DataSource dataSource) {
         Integer id = itemGroup.getId();
-        Server server = KepOpcServerUtil.createServer(dataSource);
+        Server server = null;
         List<String> itemList = itemGroupDao.getItemByIdChange(id);
         String[] items = itemList.toArray(new String[]{});
         try {
+            server = KepOpcServerUtil.createServer(dataSource);
             server.connect();
             if (null == server.getServerState()) {
                 throw new CustomException(ResultEnum.NOT_FOUND.getRespCode(), "连接失败");
@@ -139,45 +107,75 @@ public class OpcAsyncTask {
             }
         } catch (Exception e) {
             e.printStackTrace();
+            redisUtil.convertAndSend(ConstantStr.ITEM_GROUP, Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "组" + itemGroup.getGroupName() + "运行异常,错误信息为:" + e.getMessage()));
         } finally {
-            server.dispose();
+            if (Blank.isNotEmpty(server)) {
+                server.dispose();
+            }
             redisUtil.del(ConstantStr.ITEM_GROUP + id);
             itemGroupDao.runItemGroupById(id, ConstantStr.STOP_IT);
         }
     }
 
     //异步读取OpcUa
-    public void runOpcUa(ItemGroup itemGroup, DataSource dataSource) throws Exception {
+    public void runOpcUa(ItemGroup itemGroup, DataSource dataSource) {
         Integer id = itemGroup.getId();
-        OpcUaClient opcUaClient = OpcUaUtil.createClient(dataSource);
+        DataSourceType dataSourceType = dataSourceDao.getDataSourceTypeById(dataSource.getTypeId());
+        OpcUaClient opcUaClient = null;
         List<com.judong.chuanyiserver.entity.Item> itemList = itemGroupDao.getItemListByGroupId(id);
-        List<NodeId> nodeIdList = OpcUaUtil.genNodeId(itemList);
         try {
+            opcUaClient = OpcUaUtil.createClient(dataSource);
             opcUaClient.connect().get();
-            Boolean flage = true;
-            while (flage) {
-                List<RawData> rawDataList = new ArrayList<>();
-                List<DataValue> valueList = opcUaClient.readValues(0.0, TimestampsToReturn.Neither, nodeIdList).get();
-                Date date = new Date();
-                for (DataValue dataValue : valueList) {
-                    StatusCode statusCode = dataValue.getStatusCode();
-                    if (Blank.isNotEmpty(statusCode)) {
-                        if (statusCode.isGood()) {
+            if (dataSourceType.getDataSourceTypeKey().equals(DataSourceTypeEnum.OPC_UA_REAL.getValue())) {
+                Boolean flage = true;
+                List<NodeId> nodeIdList = OpcUaUtil.genNodeId(itemList);
+                while (flage) {
+                    List<RawData> rawDataList = new ArrayList<>();
+                    List<DataValue> valueList = opcUaClient.readValues(0.0, TimestampsToReturn.Both, nodeIdList).get();
+                    Date date = new Date();
+                    if(Blank.isNotEmpty(nodeIdList)){
+                        for (int i = 0; i < nodeIdList.size(); i++) {
+                            DataValue dataValue = valueList.get(i);
                             Variant value = dataValue.getValue();
                             ExpandedNodeId expandedNodeId = value.getDataType().get();
-                            rawDataList.add(new RawData(itemGroup.getDataSourceId(), expandedNodeId.getIdentifier().toString(), expandedNodeId.getType().toString(), value.getValue().toString(), date));
+                            rawDataList.add(new RawData(itemGroup.getDataSourceId(), nodeIdList.get(i).getIdentifier().toString(), expandedNodeId.getType().toString(), value.getValue().toString(), date));
                         }
                     }
+//                    for (DataValue dataValue : valueList) {
+//                        StatusCode statusCode = dataValue.getStatusCode();
+//                        if (Blank.isNotEmpty(statusCode)) {
+//                            if (statusCode.isGood()) {
+//                                Variant value = dataValue.getValue();
+//                                ExpandedNodeId expandedNodeId = value.getDataType().get();
+//                                rawDataList.add(new RawData(itemGroup.getDataSourceId(), expandedNodeId.getIdentifier().toString(), expandedNodeId.getType().toString(), value.getValue().toString(), date));
+//                            }
+//                        }
+//                    }
+                    addRawDataList(id, rawDataList);
+                    Thread.sleep(itemGroup.getModeValue() * 1000);
+                    flage = (Boolean) redisUtil.get(ConstantStr.ITEM_GROUP + id);
+                    if (Blank.isEmpty(flage)) {
+                        flage = false;
+                    }
                 }
-                addRawDataList(id, rawDataList);
-                Thread.sleep(itemGroup.getModeValue() * 1000);
-                flage = (Boolean) redisUtil.get(ConstantStr.ITEM_GROUP + id);
-                if (Blank.isEmpty(flage)) {
-                    flage = false;
+            } else if (dataSourceType.getDataSourceTypeKey().equals(DataSourceTypeEnum.OPC_UA_HISTORY.getValue())) {
+                List<HistoryReadValueId> historyReadValueIdList = OpcUaUtil.genHisNodeId(itemList);
+                List<RawData> rawDataList = new ArrayList<>();
+                Date date = new Date();
+                HistoryReadResponse historyReadResponse = opcUaClient.historyRead(new ReadRawModifiedDetails(false, DateTime.MIN_VALUE, DateTime.MIN_VALUE, UInteger.MAX, false),
+                        TimestampsToReturn.Both, true, historyReadValueIdList).get();
+                HistoryReadResult[] results = historyReadResponse.getResults();
+                for (HistoryReadResult historyReadResult : results) {
+                    System.out.println(historyReadResult);
+//                    rawDataList.add(new RawData(itemGroup.getDataSourceId(), expandedNodeId.getIdentifier().toString(), expandedNodeId.getType().toString(), value.getValue().toString(), date));
                 }
+                addRawDataList(id, rawDataList);
+            } else {
+                throw new CustomException(ResultEnum.SERVER_ERROR.getRespCode(), "目前还没有此种类型的连接方式");
             }
         } catch (Exception e) {
             e.printStackTrace();
+            redisUtil.convertAndSend(ConstantStr.ITEM_GROUP, Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "组" + itemGroup.getGroupName() + "运行异常,错误信息为:" + e.getMessage()));
         } finally {
             if (Blank.isNotEmpty(opcUaClient)) {
                 opcUaClient.disconnect();

+ 30 - 2
chuanyi_server/src/main/java/com/judong/chuanyiserver/config/RedisConfig.java

@@ -1,17 +1,46 @@
 package com.judong.chuanyiserver.config;
 
+import com.judong.chuanyiserver.util.ConstantStr;
 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;
+import org.springframework.data.redis.listener.PatternTopic;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
+import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
 import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 
 @Configuration
 public class RedisConfig {
 
+    /*
+     * Redis消息监听器容器
+     * 这个容器加载了RedisConnectionFactory和消息监听器
+     * 可以添加多个监听不同话题的redis监听器,只需要把消息监听器和相应的消息订阅处理器绑定,该消息监听器
+     * 通过反射技术调用消息订阅处理器的相关方法进行一些业务处理
+     */
     @Bean
-    public RedisTemplate<String,Object> redisTemplate(RedisConnectionFactory redisConnectionFactory){
+    public RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory, MessageListenerAdapter adapter) {
+        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
+        container.setConnectionFactory(connectionFactory);
+        //可以添加多个 messageListener
+        container.addMessageListener(adapter, new PatternTopic(ConstantStr.ITEM_GROUP));
+        return container;
+    }
+
+    /*
+     * 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
+     * 将MessageReceiver注册为一个消息监听器,可以自定义消息接收的方法(handleMessage)
+     * 如果不指定消息接收的方法,消息监听器会默认的寻找MessageReceiver中的onMessage这个方法作为消息接收的方法
+     */
+    @Bean
+    public MessageListenerAdapter adapter(MessageReceiver messageReceiver) {
+        return new MessageListenerAdapter(messageReceiver, "onMessage");
+    }
+
+    @Bean
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
         RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
         //key value序列化方式
         redisTemplate.setKeySerializer(new StringRedisSerializer());
@@ -22,6 +51,5 @@ public class RedisConfig {
         //注入连接工厂
         redisTemplate.setConnectionFactory(redisConnectionFactory);
         return redisTemplate;
-
     }
 }

+ 3 - 3
chuanyi_server/src/main/java/com/judong/chuanyiserver/config/AsyncThreadPoolConfig.java → chuanyi_server/src/main/java/com/judong/chuanyiserver/config/ThreadPoolConfig.java

@@ -7,10 +7,10 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import java.util.concurrent.ThreadPoolExecutor;
 
 /**
- * OPC线程池配置
+ * 线程池配置
  */
 @Configuration
-public class AsyncThreadPoolConfig {
+public class ThreadPoolConfig {
 
     private static final int corePoolSize = 10;               // 默认线程数
     private static final int maxPoolSize = 100;                // 最大线程数
@@ -20,7 +20,7 @@ public class AsyncThreadPoolConfig {
     private static final int awaitTerminationSeconds = 0;
     private static final String threadNamePrefix = "Async-Thread-"; // 线程池名前缀
 
-    @Bean("asyncThreadPoolTaskExecutor") // bean的名称,默认为首字母小写的方法名
+    @Bean("threadPoolTaskExecutor") // bean的名称,默认为首字母小写的方法名
     public ThreadPoolTaskExecutor taskExecutor(){
         ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
         executor.setCorePoolSize(corePoolSize);

+ 11 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/DataSourceController.java

@@ -1,7 +1,11 @@
 package com.judong.chuanyiserver.controller;
 
+import com.judong.chuanyiserver.annotation.WebLog;
 import com.judong.chuanyiserver.entity.DataSource;
+import com.judong.chuanyiserver.enums.ModelEnum;
+import com.judong.chuanyiserver.enums.OperationEnum;
 import com.judong.chuanyiserver.enums.ResultEnum;
+import com.judong.chuanyiserver.enums.ServerEnum;
 import com.judong.chuanyiserver.service.DataSourceService;
 import com.judong.chuanyiserver.util.Blank;
 import com.judong.chuanyiserver.util.Result;
@@ -24,6 +28,7 @@ public class DataSourceController {
      * @return
      */
     @GetMapping("/getDataSourceTree")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.SELECT)
     public Result getDataSourceTree() {
         return dataSourceService.getDataSourceTree();
     }
@@ -35,6 +40,7 @@ public class DataSourceController {
      * @return
      */
     @PostMapping("/addDataSource")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.ADD)
     public Result addDataSource(@RequestBody DataSource dataSource) {
         if (Blank.isEmpty(dataSource, dataSource.getTypeId(), dataSource.getDataSourceName())) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据源名称不能为空");
@@ -49,6 +55,7 @@ public class DataSourceController {
      * @return
      */
     @PostMapping("/testConnect")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.TEST)
     public Result testConnect(@RequestBody DataSource dataSource) {
         if (Blank.isEmpty(dataSource, dataSource.getTypeId(), dataSource.getDataSourceName())) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据源名称不能为空");
@@ -62,6 +69,7 @@ public class DataSourceController {
      * @return
      */
     @GetMapping("/getAllDataSource")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.SELECT)
     public Result getAllDataSource() {
         return dataSourceService.getAllDataSource();
     }
@@ -73,6 +81,7 @@ public class DataSourceController {
      * @return
      */
     @GetMapping("/getDataSourceById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.SELECT)
     public Result getDataSourceById(@PathVariable Integer id) {
         if (Blank.isEmpty(id)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
@@ -87,6 +96,7 @@ public class DataSourceController {
      * @return
      */
     @GetMapping("/getDataSourceItemTree/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.SELECT)
     public Result getDataSourceItemTree(@PathVariable Integer id) {
         if (Blank.isEmpty(id)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
@@ -101,6 +111,7 @@ public class DataSourceController {
      * @return
      */
     @PostMapping("/delDataSourceById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.DELETE)
     public Result delDataSourceById(@PathVariable Integer id) {
         if (Blank.isEmpty(id)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());

+ 23 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/DictController.java

@@ -169,5 +169,28 @@ public class DictController {
         return dictService.queryByTypes(keyType);
     }
 
+    /**
+     *查询字典类型详情
+     */
+    @GetMapping("queryDictTypeById")
+    public Result queryDictTypeById(Integer dictTypeId){
+        if (Blank.isEmpty(dictTypeId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),"参数错误");
+        }
+        return dictService.queryDictTypeById(dictTypeId);
+    }
+
+
+    /**
+     *查询字典详情
+     */
+    @GetMapping("queryDictById")
+    public Result queryDictById(Integer dictId){
+        if (Blank.isEmpty(dictId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),"参数错误");
+        }
+        return dictService.queryDictById(dictId);
+    }
+
 
 }

+ 19 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/ItemGroupController.java

@@ -1,7 +1,12 @@
 package com.judong.chuanyiserver.controller;
 
+import com.judong.chuanyiserver.annotation.WebLog;
+import com.judong.chuanyiserver.entity.Item;
 import com.judong.chuanyiserver.entity.ItemGroup;
+import com.judong.chuanyiserver.enums.ModelEnum;
+import com.judong.chuanyiserver.enums.OperationEnum;
 import com.judong.chuanyiserver.enums.ResultEnum;
+import com.judong.chuanyiserver.enums.ServerEnum;
 import com.judong.chuanyiserver.service.ItemGroupService;
 import com.judong.chuanyiserver.util.Blank;
 import com.judong.chuanyiserver.util.Result;
@@ -19,6 +24,7 @@ public class ItemGroupController {
     private ItemGroupService itemGroupService;
 
     @PostMapping("/addItemGroup")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.ADD)
     public Result addItemGroup(@RequestBody ItemGroup itemGroup) {
         if (Blank.isEmpty(itemGroup, itemGroup.getGroupName())) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "组名称不能为空");
@@ -27,11 +33,13 @@ public class ItemGroupController {
     }
 
     @GetMapping("/getAllItemGroup")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
     public Result getAllItemGroup() {
         return itemGroupService.getAllItemGroup();
     }
 
     @GetMapping("/getItemGroupById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
     public Result getItemGroupById(@PathVariable Integer id) {
         if (Blank.isEmpty(id)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
@@ -40,6 +48,7 @@ public class ItemGroupController {
     }
 
     @PostMapping("/delItemGroupById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.DELETE)
     public Result delItemGroupById(@PathVariable Integer id) {
         if (Blank.isEmpty(id)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
@@ -56,10 +65,20 @@ public class ItemGroupController {
     }
 
     @GetMapping("/getItemValueById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
     public Result getItemValueById(@PathVariable Integer id) {
         if (Blank.isEmpty(id)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
         return itemGroupService.getItemValueById(id);
     }
+
+    @PostMapping("/updateItemDescribe")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.UPDATE)
+    public Result updateItemDescribe(@RequestBody Item item) {
+        if (Blank.isEmpty(item, item.getId(), item.getDescribe())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.updateItemDescribe(item);
+    }
 }

+ 8 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/RawDataController.java

@@ -1,11 +1,14 @@
 package com.judong.chuanyiserver.controller;
 
 import com.judong.chuanyiserver.service.RawDataService;
+import com.judong.chuanyiserver.util.Result;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @RestController
 @RequestMapping("rawData")
@@ -14,4 +17,9 @@ public class RawDataController {
 
     @Resource
     private RawDataService rawDataService;
+
+    @GetMapping("/getDataByTimeType")
+    public Result getDataByTimeType(List<Integer> itemGroupIdList) {
+        return rawDataService.getDataByTimeType(itemGroupIdList);
+    }
 }

+ 17 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/ReportTableController.java

@@ -0,0 +1,17 @@
+package com.judong.chuanyiserver.controller;
+
+import com.judong.chuanyiserver.service.ReportTableService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("reportTable")
+@Slf4j
+public class ReportTableController {
+
+    @Resource
+    private ReportTableService reportTableService;
+}

+ 43 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/controller/RoleController.java

@@ -193,4 +193,47 @@ public class RoleController {
         }
         return roleService.assignRoleAndMenu(role);
     }
+
+    /**
+     * 查看角色已有的菜单
+     *
+     */
+    @GetMapping("/queryRoleAndMenuId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryRoleAndMenuId(Integer roleId,Integer page,Integer num){
+        if (Blank.isEmpty(roleId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryRoleAndMenuId(roleId,page,num);
+    }
+
+    /**
+     * 查看角色未有的菜单
+     *
+     */
+    @GetMapping("/queryNotRoleAndMenu")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryNotRoleAndMenu(Integer roleId,Integer page,Integer num){
+        if (Blank.isEmpty(roleId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryNotRoleAndMenu(roleId,page,num);
+    }
+
+    /**
+     * 角色已有菜单id
+     *
+     */
+    @GetMapping("/queryRoleAndMenuListId")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryRoleAndMenuListId(Integer roleId){
+        if (Blank.isEmpty(roleId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryRoleAndMenuListId(roleId);
+    }
+
+
 }

+ 4 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/DictDao.java

@@ -126,4 +126,8 @@ public interface DictDao {
      */
     List<Dict> queryByTypes(String keyType);
 
+    DictType queryDictTypeById(Integer dictTypeId);
+
+    Dict queryDictById(Integer dictId);
+
 }

+ 10 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/FileDao.java

@@ -0,0 +1,10 @@
+package com.judong.chuanyiserver.dao;
+
+import com.judong.chuanyiserver.entity.FileEntity;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface FileDao {
+
+    Integer saveFile(FileEntity fileEntity);
+}

+ 2 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/ItemGroupDao.java

@@ -36,4 +36,6 @@ public interface ItemGroupDao {
     Integer runItemGroupById(Integer id, Integer runState);
 
     List<String> getItemByIdChange(Integer id);
+
+    Integer updateItemDescribe(Item item);
 }

+ 7 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/ReportTableDao.java

@@ -0,0 +1,7 @@
+package com.judong.chuanyiserver.dao;
+
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ReportTableDao {
+}

+ 25 - 1
chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/RoleDao.java

@@ -62,10 +62,11 @@ public interface RoleDao {
     List<Role> queryRoleByRoleIds(@Param("ids") List<Integer> ids);
 
     /**
-     * 查询角色对应菜单的角色菜单id
+     * 查询角色对应菜单
      */
     List<Integer> queryRoleAndMenuId(Integer roleId);
 
+
     /**
      * 批量新增角色菜单
      */
@@ -76,5 +77,28 @@ public interface RoleDao {
      */
     Integer deleteRoleAndMenu(@Param("role") Role role);
 
+    /**
+     * 查询角色未有菜单
+     */
+    List<Menu> queryNotRoleAndMenu(Integer roleId,Integer page,Integer num);
+
+    Integer queryNotRoleAndMenuNum(Integer roleId);
+
+    /**
+     * 查询角色已有菜单分页
+     */
+    List<Menu> queryRoleAndMenuIdPage(Integer roleId,Integer page,Integer num);
+
+    Integer queryRoleAndMenuIdNum(Integer roleId);
+
+    /**
+     * 查询角色已有菜单id
+     */
+    List<Integer> queryRoleAndMenuListId(Integer roleId);
+
+    /**
+     * 根据用户id删除用户角色关联信息
+     */
+    Integer deleteUserRoleByUserId(String userId);
 
 }

+ 5 - 1
chuanyi_server/src/main/java/com/judong/chuanyiserver/dao/UserDao.java

@@ -11,7 +11,7 @@ import java.util.List;
 @Repository
 public interface UserDao {
 
-    User getUserByNamePass(String userName, String password);
+    List<User> getUserByNamePass(String userName, String password);
 
     User getUserById(String userId);
 
@@ -70,6 +70,10 @@ public interface UserDao {
      */
     Integer updatePassWord(@Param("user") User user);
 
+    Integer queryUserName(String name);
+
+    User getUserByNamePassByUpdate(String userName, String password);
+
 
 
 

+ 44 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/entity/FileEntity.java

@@ -0,0 +1,44 @@
+package com.judong.chuanyiserver.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class FileEntity implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 保存的路径
+     */
+    private String filePath;
+    /**
+     * 文件原始名称
+     */
+    private String originalFileName;
+    /**
+     * 保存的文件名称
+     */
+    private String saveFileName;
+    /**
+     * 文件后缀名
+     */
+    private String suffixName;
+    /**
+     * 创建时间
+     */
+    private String createTime;
+
+    public FileEntity(String filePath, String originalFileName, String saveFileName, String suffixName) {
+        this.filePath = filePath;
+        this.originalFileName = originalFileName;
+        this.saveFileName = saveFileName;
+        this.suffixName = suffixName;
+    }
+
+}

+ 2 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/entity/Item.java

@@ -27,4 +27,6 @@ public class Item implements Serializable {
     private Integer nodeIndex;
     private String nodeIdentifier;
     private String dataType;
+
+    private String describe;
 }

+ 9 - 7
chuanyi_server/src/main/java/com/judong/chuanyiserver/enums/ModelEnum.java

@@ -4,17 +4,19 @@ public enum ModelEnum {
 
     UNKNOWN("未知模块", "UNKNOWN"),
 
-    USER("用户管理", "USER"), ROLE("角色管理", "ROLE"), BASIC_DATA("基础数据", "BASIC_DATA"), MENU("菜单管理", "MENU"),PERMISSION("接口权限管理", "PERMISSION"),
+    USER("用户管理", "USER"), ROLE("角色管理", "ROLE"), BASIC_DATA("基础数据", "BASIC_DATA"), MENU("菜单管理", "MENU"), PERMISSION("接口权限管理", "PERMISSION"),
     DEPARTMENT("部门管理", "DEPARTMENT"), GROUP("用户组管理", "GROUP"), PERSON("人员管理", "PERSON"),
 
-    CONNECT("连接","CONNECT"),
-    PASSAGEWAY("通道","PASSAGEWAY"),
-    CONFIGURE("配置","CONFIGURE"),
-    RUNNING("运行","RUNNING"),
-    DATASOURCE("数据源","DATASOURCE"),
+    CONNECT("连接", "CONNECT"),
+    PASSAGEWAY("通道", "PASSAGEWAY"),
+    CONFIGURE("配置", "CONFIGURE"),
+    RUNNING("运行", "RUNNING"),
+    DATASOURCE("数据源配置", "DATASOURCE"),
+    DATAGROUP("数据组配置", "DATAGROUP"),
+    RUNSETUP("运行配置", "RUNSETUP"),
 
     SIGNIN("登录", "SIGNIN"), LOGOUT("退出登录", "LOGOUT"), REGISTER("注册", "REGISTER"), HOMEBYPAGE("首页", "HOMEBYPAGE"),
-    UPDATECODE("发送验证码", "UPDATECODE"), SEARCH("房源搜索", "SEARCH");
+    UPDATECODE("发送验证码", "UPDATECODE");
 
     private String value;
 

+ 1 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/enums/OperationEnum.java

@@ -10,6 +10,7 @@ public enum OperationEnum {
     IMPORT("导入", "IMPORT"), EXPORT("导出", "EXPORT"),
     REGISTER("注册", "REGISTER"),
     TEST("测试", "TEST"), OPEN("打开", "OPEN"), CLOSE("关闭", "CLOSE"),
+    RUN("运行", "RUN"), STOPIT("停用", "STOPIT"),
     READ("读取", "READ");
 
     private String value;

+ 4 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/DictService.java

@@ -91,4 +91,8 @@ public interface DictService {
      *根据字典类型查询对应数据(不分页)
      */
     Result queryByTypes(String keyType);
+
+    Result queryDictTypeById(Integer dictTypeId);
+
+    Result queryDictById(Integer dictId);
 }

+ 3 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/ItemGroupService.java

@@ -1,5 +1,6 @@
 package com.judong.chuanyiserver.service;
 
+import com.judong.chuanyiserver.entity.Item;
 import com.judong.chuanyiserver.entity.ItemGroup;
 import com.judong.chuanyiserver.util.Result;
 
@@ -15,4 +16,6 @@ public interface ItemGroupService {
     Result runItemGroupById(Integer id, Integer runState);
 
     Result getItemValueById(Integer id);
+
+    Result updateItemDescribe(Item item);
 }

+ 6 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/RawDataService.java

@@ -1,4 +1,10 @@
 package com.judong.chuanyiserver.service;
 
+import com.judong.chuanyiserver.util.Result;
+
+import java.util.List;
+
 public interface RawDataService {
+
+    Result getDataByTimeType(List<Integer> itemGroupIdList);
 }

+ 4 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/ReportTableService.java

@@ -0,0 +1,4 @@
+package com.judong.chuanyiserver.service;
+
+public interface ReportTableService {
+}

+ 15 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/RoleService.java

@@ -38,4 +38,19 @@ public interface RoleService {
      * 为角色分配菜单
      */
     Result assignRoleAndMenu(Role role);
+
+    /**
+     * 查询角色已有菜单
+     */
+    Result queryRoleAndMenuId(Integer roleId,Integer page,Integer num);
+
+    /**
+     * 查询角色未有菜单
+     */
+    Result queryNotRoleAndMenu(Integer roleId,Integer page,Integer num);
+
+    /**
+     * 查询角色已有菜单id
+     */
+    Result queryRoleAndMenuListId(Integer roleId);
 }

+ 0 - 7
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/ChannelSettingServiceImpl.java

@@ -1,7 +1,6 @@
 package com.judong.chuanyiserver.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
-import com.judong.chuanyiserver.config.KepOpcServerTimerTask;
 import com.judong.chuanyiserver.config.OpcAsyncTask;
 import com.judong.chuanyiserver.dao.ChannelSettingDao;
 import com.judong.chuanyiserver.dao.ConnectDao;
@@ -19,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Timer;
 
 @Service
 @Transactional
@@ -179,14 +177,11 @@ public class ChannelSettingServiceImpl implements ChannelSettingService {
             if (KepOpcServerUtil.validationServerInformation(serverInformation)) {
                 if (runState==ConstantStr.START_UP){
                     //将配置的状态更换为运行
-                    Timer timer = new Timer(true);
-                    timer.scheduleAtFixedRate(new KepOpcServerTimerTask(serverInformation,channelSettingList),0,1*1000);
 
 //                    opcAsyncTask.KepServerReadItemList(serverInformation, channelSettingList);
                 }else{
                     //将配置的状态更换为停止
 
-                    opcAsyncTask.KepServerCloseReadItemList(serverInformation, channelSettingList);
                 }
                 return Result.ok("操作成功");
             }
@@ -194,9 +189,7 @@ public class ChannelSettingServiceImpl implements ChannelSettingService {
         } else if (serverInformation.getConnectMode() == ConnectModeEnum.KingOPCServer.getValue()) {
             if (OpcServerUaUtil.validationServerInformation(serverInformation)) {
                 if (runState==ConstantStr.START_UP){
-                    opcAsyncTask.OpcServerUaReadItemList(serverInformation, channelSettingList);
                 }else{
-                    opcAsyncTask.OpcServerUaCloseReadItemList(serverInformation, channelSettingList);
                 }
                 return Result.ok("操作成功");
             }

+ 1 - 2
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/DataSourceServiceImpl.java

@@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.judong.chuanyiserver.dao.DataSourceDao;
 import com.judong.chuanyiserver.entity.DataSource;
 import com.judong.chuanyiserver.entity.DataSourceType;
-import com.judong.chuanyiserver.enums.DataSourceTypeEnum;
-import com.judong.chuanyiserver.enums.ResultEnum;
+import com.judong.chuanyiserver.enums.*;
 import com.judong.chuanyiserver.exception.CustomException;
 import com.judong.chuanyiserver.service.DataSourceService;
 import com.judong.chuanyiserver.util.*;

+ 10 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/DictServiceImpl.java

@@ -228,4 +228,14 @@ public class DictServiceImpl implements DictService {
         List<Dict> dicts = dictDao.queryByTypes(keyType);
         return Result.ok(dicts);
     }
+
+    @Override
+    public Result queryDictTypeById(Integer dictTypeId) {
+        return Result.ok(dictDao.queryDictTypeById(dictTypeId));
+    }
+
+    @Override
+    public Result queryDictById(Integer dictId) {
+        return Result.ok(dictDao.queryDictById(dictId));
+    }
 }

+ 9 - 5
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/ItemGroupServiceImpl.java

@@ -161,11 +161,7 @@ public class ItemGroupServiceImpl implements ItemGroupService {
                     }
                 }
                 //异步读取opcUA数据并保存
-                try {
-                    opcAsyncTask.runOpcUa(itemGroup, dataSource);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
+                opcAsyncTask.runOpcUa(itemGroup, dataSource);
             } else if (dataSourceType.getDataSourceTypeKey().equals(DataSourceTypeEnum.OPC_DA_REAL.getValue()) ||
                     dataSourceType.getDataSourceTypeKey().equals(DataSourceTypeEnum.OPC_HDA_HISTORY.getValue()) ||
                     dataSourceType.getDataSourceTypeKey().equals(DataSourceTypeEnum.OPC_AE_ALARMS.getValue())
@@ -235,4 +231,12 @@ public class ItemGroupServiceImpl implements ItemGroupService {
             return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "目前还没有此种类型的连接方式");
         }
     }
+
+    @Override
+    public Result updateItemDescribe(Item item) {
+        if (itemGroupDao.updateItemDescribe(item) <= 0) {
+            return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "修改item描述失败");
+        }
+        return Result.ok("修改item描述成功");
+    }
 }

+ 6 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/MenuServiceImpl.java

@@ -28,6 +28,9 @@ public class MenuServiceImpl implements MenuService {
         if (Blank.isEmpty(menu.getParentId(), menu.getMenuName(), menu.getMenuUrl())) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "父id,菜单名称,菜单路径不能为空");
         }
+        if (menu.getId()==menu.getParentId()){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "无效菜单,请重试!");
+        }
         if (menu.getParentId() == ConstantStr.TOP_LEVEL_MENU) {
             if (Blank.isNotEmpty(menuDao.getMenuByName(menu.getMenuName(),0))) {
                 return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "该顶级菜单名称已被使用,请更换其他顶级菜单名称");
@@ -53,6 +56,9 @@ public class MenuServiceImpl implements MenuService {
         if (Blank.isEmpty(menu.getId(), menu.getMenuName(), menu.getMenuUrl(), menu.getMenuStatus())) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "id,菜单名称,菜单路径,菜单状态不能为空");
         }
+        if (menu.getId()==menu.getParentId()){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "无效菜单,请重试!");
+        }
         Menu oldMenu = menuDao.getMenuById(menu.getId());
         if (oldMenu.getParentId() == ConstantStr.TOP_LEVEL_MENU) {
             if (Blank.isNotEmpty(menuDao.getMenuByNoIdName(menu.getId(), menu.getMenuName(),0))) {

+ 8 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/RawDataServiceImpl.java

@@ -2,10 +2,12 @@ package com.judong.chuanyiserver.service.impl;
 
 import com.judong.chuanyiserver.dao.RawDataDao;
 import com.judong.chuanyiserver.service.RawDataService;
+import com.judong.chuanyiserver.util.Result;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @Service
 @Transactional
@@ -13,4 +15,10 @@ public class RawDataServiceImpl implements RawDataService {
 
     @Resource
     private RawDataDao rawDataDao;
+
+    @Override
+    public Result getDataByTimeType(List<Integer> itemGroupIdList) {
+
+        return null;
+    }
 }

+ 16 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/ReportTableServiceImpl.java

@@ -0,0 +1,16 @@
+package com.judong.chuanyiserver.service.impl;
+
+import com.judong.chuanyiserver.dao.ReportTableDao;
+import com.judong.chuanyiserver.service.ReportTableService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+@Service
+@Transactional
+public class ReportTableServiceImpl implements ReportTableService {
+
+    @Resource
+    private ReportTableDao reportTableDao;
+}

+ 43 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/RoleServiceImpl.java

@@ -1,6 +1,7 @@
 package com.judong.chuanyiserver.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.judong.chuanyiserver.dao.MenuDao;
 import com.judong.chuanyiserver.dao.RoleDao;
 import com.judong.chuanyiserver.entity.Menu;
 import com.judong.chuanyiserver.entity.Role;
@@ -27,6 +28,9 @@ public class RoleServiceImpl implements RoleService {
     @Resource
     private UserUtil userUtil;
 
+    @Resource
+    private MenuDao menuDao;
+
     @Override
     public synchronized Result addRole(Role role) {
         if (Blank.isNotEmpty(roleDao.getRoleByName(role.getRoleName()))) {
@@ -210,6 +214,45 @@ public class RoleServiceImpl implements RoleService {
         return Result.ok(jsonObject);
     }
 
+    @Override
+    public Result queryRoleAndMenuId(Integer roleId,Integer page,Integer num) {
+        JSONObject jsonObject = new JSONObject();
+        Integer count = roleDao.queryRoleAndMenuIdNum(roleId);
+        Integer stattPage=(page-1)*num;
+        List<Menu> menuList = roleDao.queryRoleAndMenuIdPage(roleId, stattPage, num);
+        jsonObject.put("count",count);
+        jsonObject.put("menuList",menuList);
+        return Result.ok(jsonObject);
+    }
+
+    @Override
+    public Result queryNotRoleAndMenu(Integer roleId, Integer page, Integer num) {
+        JSONObject jsonObject = new JSONObject();
+        Integer count = roleDao.queryNotRoleAndMenuNum(roleId);
+        Integer stattPage=(page-1)*num;
+        List<Menu> menuList = roleDao.queryNotRoleAndMenu(roleId, stattPage, num);
+        jsonObject.put("count",count);
+        jsonObject.put("menuList",menuList);
+        return Result.ok(jsonObject);
+    }
+
+    @Override
+    public Result queryRoleAndMenuListId(Integer roleId) {
+        List<Integer> menuListId = roleDao.queryRoleAndMenuListId(roleId);
+        return Result.ok(menuListId);
+    }
+
+    public List<Menu> menuChildren(Integer parentId){
+        List<Menu> menus = new ArrayList<>();
+        List<Menu> menuList = menuDao.queryAllMenuTree(parentId);
+        for (Menu menu:menuList){
+            menu.setChildren(menuChildren(menu.getId()));
+            menus.add(menu);
+        }
+        return menus;
+    }
+
+
     public List<JSONObject> gennerMenuTree(List<Menu> menuList, Integer parentId) {
         List<JSONObject> jsonObjectList = new ArrayList<>();
         if (Blank.isEmpty(menuList)) {

+ 58 - 14
chuanyi_server/src/main/java/com/judong/chuanyiserver/service/impl/UserServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.captcha.CaptchaUtil;
 import cn.hutool.captcha.ShearCaptcha;
 import cn.hutool.core.convert.Convert;
 import com.alibaba.fastjson.JSONObject;
+import com.judong.chuanyiserver.dao.RoleDao;
 import com.judong.chuanyiserver.dao.UserDao;
 import com.judong.chuanyiserver.entity.Role;
 import com.judong.chuanyiserver.entity.User;
@@ -36,6 +37,9 @@ public class UserServiceImpl implements UserService {
     @Resource
     private UserUtil userUtil;
 
+    @Resource
+    private RoleDao roleDao;
+
     @Override
     public Result getCodeImage(boolean hasPubKey) {
         JSONObject jsonObject = new JSONObject();
@@ -71,7 +75,24 @@ public class UserServiceImpl implements UserService {
         } catch (Exception e) {
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
-        User isExistUser = userDao.getUserByNamePass(user.getUserName(), EncryptUtils.StrToMD5(user.getPassword()));
+        User isExistUser =null;
+        Boolean falg=true;
+        List<User> userList = userDao.getUserByNamePass(user.getUserName(), EncryptUtils.StrToMD5(user.getPassword()));
+        if (userList.size()==1){
+            isExistUser=userList.get(0);
+            falg=false;
+        }else {
+            for (User u:userList){
+                if (u.getState() !=2){
+                    isExistUser=u;
+                    falg=false;
+                    break;
+                }
+            }
+        }
+        if (falg){
+            isExistUser=userList.get(0);
+        }
         if (Blank.isEmpty(isExistUser)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "用户名或密码错误");
         }
@@ -120,22 +141,44 @@ public class UserServiceImpl implements UserService {
      */
     @Override
     public Result backUserLogin(User user) {
+        //判断账号是否存在
+        Integer userName = userDao.queryUserName(user.getUserName());
+        if (userName<=0){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "用户名不存在");
+        }
         //获取登陆失败次数
         Integer count = (Integer) redisUtil.get("Number of password errors:" + user.getUserName());
-        if (Blank.isEmpty(count)){
-            count=0;
+        if (Blank.isEmpty(count)) {
+            count = 0;
         }
         try {
             user.setPassword(RSAUtil.decrypt(user.getPassword(), "UTF-8"));
         } catch (Exception e) {
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
-        User isExistUser = userDao.getUserByNamePass(user.getUserName(), EncryptUtils.StrToMD5(user.getPassword()));
+        User isExistUser =null;
+        Boolean falg=true;
+        List<User> userList = userDao.getUserByNamePass(user.getUserName(), EncryptUtils.StrToMD5(user.getPassword()));
+        if (userList.size()==1){
+            isExistUser=userList.get(0);
+            falg=false;
+        }else {
+            for (User u:userList){
+                if (u.getState() !=2){
+                    isExistUser=u;
+                    falg=false;
+                    break;
+                }
+            }
+        }
+        if (falg){
+            isExistUser=userList.get(0);
+        }
         if (Blank.isEmpty(isExistUser)) {
             //记录登陆失败次数
             count++;
-            if (count>=5){
-                if (count.equals(5)){
+            if (count >= 5) {
+                if (count.equals(5)) {
                     //账号锁定5分钟
                     redisUtil.set("Number of password errors:" + user.getUserName(), count, 300);
                 }
@@ -143,9 +186,9 @@ public class UserServiceImpl implements UserService {
                 long minutes = expire / 60;
                 long second = expire % 60;
                 return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "密码错误次数过多账号已锁定,请" + minutes + "分" + second + "秒后再试");
-            }else {
+            } else {
                 redisUtil.set("Number of password errors:" + user.getUserName(), count, 300);
-                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),  "密码错误,还可尝试" + (5 - count) + "次");
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "密码错误,还可尝试" + (5 - count) + "次");
             }
         }
         if (isExistUser.getUserType() != ConstantStr.BACK_USER) {
@@ -321,6 +364,7 @@ public class UserServiceImpl implements UserService {
         if (userDao.updateUserState(userId, ConstantStr.TOMBSTONE) <= 0) {
             return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "删除用户失败");
         }
+        roleDao.deleteUserRoleByUserId(userId);
         return Result.ok("删除用户成功");
     }
 
@@ -375,7 +419,7 @@ public class UserServiceImpl implements UserService {
     @Override
     public Result relieveUserRoles(List<UserRole> userRoles) {
         Integer num = userDao.deleteByUserIdRoleIds(userRoles);
-        if (num<=0){
+        if (num <= 0) {
             return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "解除角色失败");
         }
         return Result.ok(num);
@@ -391,12 +435,12 @@ public class UserServiceImpl implements UserService {
         } catch (Exception e) {
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
-        if (Blank.isEmpty(oldPassword,newPassword)){
+        if (Blank.isEmpty(oldPassword, newPassword)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据有误");
         }
         //判断原始密码是否正确
-        User isExistUser = userDao.getUserByNamePass(user.getUserName(), EncryptUtils.StrToMD5(oldPassword));
-        if (isExistUser==null){
+        User isExistUser = userDao.getUserByNamePassByUpdate(user.getUserName(), EncryptUtils.StrToMD5(oldPassword));
+        if (isExistUser == null) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "旧密码输入错误");
         }
         //修改密码
@@ -408,7 +452,7 @@ public class UserServiceImpl implements UserService {
     @Override
     public Result updatePasswordByAdmin(User user) {
         //判断当前登陆人是否是管理员
-        if (! userUtil.haveAdminRights()){
+        if (!userUtil.haveAdminRights()) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "没有操作权限");
         }
         String newPassword;
@@ -417,7 +461,7 @@ public class UserServiceImpl implements UserService {
         } catch (Exception e) {
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
-        if (Blank.isEmpty(newPassword)){
+        if (Blank.isEmpty(newPassword)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据有误");
         }
         user.setNewPassword(EncryptUtils.StrToMD5(newPassword));

+ 17 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/task/KepServerTimerTask.java

@@ -0,0 +1,17 @@
+package com.judong.chuanyiserver.task;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.TimerTask;
+
+@Slf4j
+public class KepServerTimerTask extends TimerTask {
+
+    @Override
+    public void run() {
+        for (int i = 0; i < 1000; i++) {
+
+        }
+        log.info("前面是kepserver线程的信息,请查看");
+    }
+}

+ 17 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/task/OpcUaTimerTask.java

@@ -0,0 +1,17 @@
+package com.judong.chuanyiserver.task;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+
+import java.util.TimerTask;
+
+@Slf4j
+public class OpcUaTimerTask extends TimerTask {
+    @Override
+    public void run() {
+        for (int i = 0; i < 1000; i++) {
+
+        }
+        log.info("前面opcUa执行的线程信息,请查看");
+    }
+}

+ 98 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/util/FileUtil.java

@@ -0,0 +1,98 @@
+package com.judong.chuanyiserver.util;
+
+import cn.hutool.core.io.FileTypeUtil;
+import com.judong.chuanyiserver.dao.FileDao;
+import com.judong.chuanyiserver.entity.FileEntity;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.util.Calendar;
+import java.util.Date;
+
+@Slf4j
+@Component
+@Transactional
+public class FileUtil {
+
+    @Value("${file.path}")
+    private String filePath;
+
+    @Resource
+    private FileDao fileDao;
+
+    /**
+     * 上传单个上传文件
+     *
+     * @param file
+     */
+    public void fileOneUpload(MultipartFile file) {
+        if (Blank.isEmpty(file)) {
+            return;
+        }
+        Calendar cal = Calendar.getInstance();
+        Date date = new Date();//现在的日期
+        cal.setTime(date);
+        Integer year = cal.get(Calendar.YEAR);//获取年
+        Integer month = cal.get(Calendar.MONTH) + 1;//获取月(月份从0开始,如果按照中国的习惯,需要加一)
+        Integer day_moneth = cal.get(Calendar.DAY_OF_MONTH);//获取日(月中的某一天)
+        String fileSavePath = filePath + "\\" + year + "\\" + month + "\\" + day_moneth;
+        File file1 = new File(fileSavePath);
+        if (!file1.exists() && !file1.isDirectory()) {
+            file1.mkdirs();
+        }
+        String originalFileName = file.getOriginalFilename();
+        String suffixName = FileTypeUtil.getType((File) file);
+        String saveFileName = (new Date()).getTime() + ((int) (Math.random() * 90000) + 10000) + "." + suffixName;
+        FileEntity fileEntity = new FileEntity(fileSavePath, originalFileName, saveFileName, suffixName);
+        if (fileDao.saveFile(fileEntity) <= 0) {
+            return;
+        }
+        File newFile = new File(fileSavePath + "\\" + saveFileName);
+        try {
+            file.transferTo(newFile);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 上传多个文件
+     *
+     * @param files
+     */
+    public void fileManyUpload(MultipartFile[] files) {
+        if (Blank.isEmpty(files)) {
+            return;
+        }
+        Calendar cal = Calendar.getInstance();
+        Date date = new Date();//现在的日期
+        cal.setTime(date);
+        Integer year = cal.get(Calendar.YEAR);//获取年
+        Integer month = cal.get(Calendar.MONTH) + 1;//获取月(月份从0开始,如果按照中国的习惯,需要加一)
+        Integer day_moneth = cal.get(Calendar.DAY_OF_MONTH);//获取日(月中的某一天)
+//        Integer day_week=cal.get(Calendar.DAY_OF_WEEK);//获取一周内的某一天
+        for (MultipartFile file : files) {
+            String fileSavePath = filePath + "\\" + year + "\\" + month + "\\" + day_moneth;
+            String originalFileName = file.getOriginalFilename();
+            String suffixName = FileTypeUtil.getType((File) file);
+            String saveFileName = (new Date()).getTime() + ((int) (Math.random() * 90000) + 10000) + "." + suffixName;
+            FileEntity fileEntity = new FileEntity(fileSavePath, originalFileName, saveFileName, suffixName);
+            Integer integer = fileDao.saveFile(fileEntity);
+        }
+    }
+
+    public void fileUpload(HttpServletRequest request, HttpServletResponse response) {
+
+    }
+
+    public static void fileDownload(MultipartFile[] files) {
+
+    }
+}

+ 6 - 2
chuanyi_server/src/main/java/com/judong/chuanyiserver/util/MathUtil.java

@@ -12,11 +12,15 @@ public class MathUtil {
 
     /**
      * 四则混合运算
+     *
+     * @param parameter  变量代表字符串
+     * @param MathString 数学表达式字符串
+     * @param value      变量值
+     * @return
+     * @throws ParseException
      */
     public static BigDecimal quadricOperation(String parameter, String MathString, Long value) throws ParseException {
         Scope scope = new Scope();
-//        Variable a = scope.getVariable("BBC");
-//        Expression expr = Parser.parse("-2*(BBC+25)+2/7+18*2^2", scope);
         Variable a = scope.getVariable(parameter);
         Expression expr = Parser.parse(MathString, scope);
         a.setValue(value);

+ 34 - 1
chuanyi_server/src/main/java/com/judong/chuanyiserver/util/OpcUaUtil.java

@@ -22,6 +22,7 @@ import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.Unsigned;
 import org.eclipse.milo.opcua.stack.core.types.enumerated.IdType;
 import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn;
 import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription;
+import org.eclipse.milo.opcua.stack.core.types.structured.HistoryReadValueId;
 
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -196,14 +197,46 @@ public class OpcUaUtil {
         return nodeIdList;
     }
 
+    public static List<HistoryReadValueId> genHisNodeId(List<Item> itemList) {
+        if (Blank.isEmpty(itemList)) {
+            return null;
+        }
+        List<HistoryReadValueId> historyReadValueIdList = new ArrayList<>();
+        for (Item item : itemList) {
+            HistoryReadValueId historyReadValueId = new HistoryReadValueId(new NodeId(item.getNodeIndex(), item.getNodeIdentifier()),
+                    null, QualifiedName.NULL_VALUE, null);
+            historyReadValueIdList.add(historyReadValueId);
+        }
+        return historyReadValueIdList;
+    }
+
     public static List<JSONObject> opcUaReadNodeIdList(DataSource dataSource, List<NodeId> nodeIdList) {
         OpcUaClient client = null;
         try {
             client = OpcUaUtil.createClient(dataSource);
             client.connect().get();
-            List<DataValue> valueList = client.readValues(0.0, TimestampsToReturn.Neither, nodeIdList).get();
+            List<DataValue> valueList = client.readValues(0.0, TimestampsToReturn.Both, nodeIdList).get();
             Date date = new Date();
             List<JSONObject> jsonObjectList = new ArrayList<>();
+            if (Blank.isNotEmpty(nodeIdList)){
+                for (int i = 0; i <nodeIdList.size() ; i++) {
+                    DataValue dataValue = valueList.get(i);
+                    JSONObject jsonObject = new JSONObject();
+                    jsonObject.put("dataSourceName", dataSource.getDataSourceName());
+                    jsonObject.put("itemName", nodeIdList.get(i).getIdentifier());
+                    StatusCode statusCode = dataValue.getStatusCode();
+                    if (Blank.isNotEmpty(statusCode)) {
+                        if (statusCode.isGood()) {
+                            Variant value = dataValue.getValue();
+                            ExpandedNodeId expandedNodeId = value.getDataType().get();
+                            jsonObject.put("dataType", expandedNodeId.getType().toString());
+                            jsonObject.put("dataValue", value.getValue());
+                        }
+                    }
+                    jsonObject.put("createTime", date);
+                    jsonObjectList.add(jsonObject);
+                }
+            }
             for (DataValue dataValue : valueList) {
                 JSONObject jsonObject = new JSONObject();
                 jsonObject.put("dataSourceName", dataSource.getDataSourceName());

+ 0 - 54
chuanyi_server/src/main/java/com/judong/chuanyiserver/util/Test.java

@@ -1,54 +0,0 @@
-package com.judong.chuanyiserver.util;
-
-import com.alibaba.fastjson.JSONObject;
-import com.judong.chuanyiserver.enums.ConnectModeEnum;
-import com.judong.chuanyiserver.enums.ResultEnum;
-import com.judong.chuanyiserver.exception.CustomException;
-import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
-import org.eclipse.milo.opcua.sdk.client.api.UaClient;
-import org.eclipse.milo.opcua.stack.core.Stack;
-import org.openscada.opc.dcom.da.OPCSERVERSTATE;
-import org.openscada.opc.lib.common.ConnectionInformation;
-import org.openscada.opc.lib.da.Server;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-
-public class Test {
-
-    private static Logger logger = LoggerFactory.getLogger(Test.class);
-
-    public static void main(String[] args) throws Exception {
-        final ConnectionInformation ci = new ConnectionInformation();
-        ci.setHost("192.168.0.252"); // 安装opc电脑IP
-        ci.setDomain(""); // 域,为空就行
-        ci.setUser("administrator"); // 电脑上自己建好的用户名
-        ci.setPassword("jd123456"); // 用户名的密码
-        // 使用KepOPC Server的配置
-        ci.setClsid(ConnectModeEnum.KEPOPCSERVER.getName()); // KEPServer的注册表ID,可以在“组件服务”里看到
-        Server server = new Server(ci, Executors.newSingleThreadScheduledExecutor());
-        try {
-            // 连接到服务
-            long start = System.currentTimeMillis();
-            server.connect();
-            long finish = System.currentTimeMillis();
-            if (null == server.getServerState()) {
-                logger.info("连接失败");
-            }
-            if (OPCSERVERSTATE.OPC_STATUS_RUNNING == server.getServerState().getServerState()) {
-                logger.info("连接成功");
-            }
-        } catch (Exception e) {
-            logger.info(e.getMessage());
-        } finally {
-            //关闭连接使用
-            server.dispose();
-        }
-    }
-
-
-}

+ 53 - 0
chuanyi_server/src/main/java/com/judong/chuanyiserver/util/TestUtil.java

@@ -0,0 +1,53 @@
+package com.judong.chuanyiserver.util;
+
+import com.judong.chuanyiserver.config.OpcAsyncTask;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+@Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class TestUtil {
+
+    @Resource
+    public OpcAsyncTask opcAsyncTask;
+
+    @Test
+    public void test() {
+//        opcAsyncTask.testA();
+//        opcAsyncTask.testB();
+
+        TimerTask timerTask = new TimerTask() {
+            @Override
+            public void run() {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
+                int n = 0;
+                long l1 = System.currentTimeMillis();
+                for (int i = 0; i <100000000 ; i++) {
+                    for (int j = 0; j < 100000000; j++) {
+                        n=i*j;
+//                        System.out.println(n);
+                    }
+                }
+                System.out.println(n);
+                long l2 = System.currentTimeMillis();
+                System.out.println(l2 - l1);
+                log.info(sdf.format(new Date(System.currentTimeMillis())));
+            }
+        };
+        Timer timer = new Timer();
+        timer.schedule(timerTask, 0, 1000);
+        //        timer.cancel();
+    }
+
+
+}

+ 1 - 1
chuanyi_server/src/main/resources/mapper/DepartmentDao.xml

@@ -75,7 +75,7 @@
     <!--根据父id查子数据-->
     <select id="queryDepartmentListByparentId" resultType="com.judong.chuanyiserver.entity.Department">
         SELECT id, parent_id, department_name, department_describe, department_num, create_time, update_time
-        FROM sys_department WHERE parent_id=#{parentId} and is_delete !=1
+        FROM sys_department WHERE parent_id=#{parentId} and is_delete !=1 order by department_num ASC
     </select>
 
     <!--根据id查自己是哪些的父亲-->

+ 8 - 0
chuanyi_server/src/main/resources/mapper/DictDao.xml

@@ -228,6 +228,14 @@
         ORDER BY sd.sort_num ASC
     </select>
 
+    <select id="queryDictTypeById" resultType="com.judong.chuanyiserver.entity.DictType">
+        SELECT  id,dict_key_type,dict_key_value,sort_num,description FROM sys_dict_type WHERE id=#{dictTypeId}
+    </select>
+
+    <select id="queryDictById" resultType="com.judong.chuanyiserver.entity.Dict">
+        SELECT id,parent_id,dict_key,dict_value,dict_type_id,sort_num,create_time FROM sys_dict WHERE id=#{dictId}
+    </select>
+
 
 
 

+ 10 - 0
chuanyi_server/src/main/resources/mapper/FileDao.xml

@@ -0,0 +1,10 @@
+<?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.judong.chuanyiserver.dao.FileDao">
+
+
+    <insert id="saveFile">
+        insert into t_file(file_path, original_file_name, save_file_name, suffix_name, create_time)
+            value (#{filePath}, #{originalFileName}, #{saveFileName}, #{suffixName}, now())
+    </insert>
+</mapper>

+ 10 - 4
chuanyi_server/src/main/resources/mapper/ItemGroupDao.xml

@@ -10,10 +10,10 @@
     </insert>
 
     <insert id="addItem">
-        insert into t_item (item_group_id, item_name,node_index,node_identifier,data_type)
+        insert into t_item (item_group_id, item_name,node_index,node_identifier,data_type,`describe`)
         VALUES
         <foreach collection="itemList" item="item" index="index" separator=",">
-            (#{itemGroupId},#{item.itemName},#{item.nodeIndex},#{item.nodeIdentifier},#{item.dataType})
+            (#{itemGroupId},#{item.itemName},#{item.nodeIndex},#{item.nodeIdentifier},#{item.dataType},#{describe})
         </foreach>
     </insert>
 
@@ -33,6 +33,12 @@
         where id = #{id}
     </update>
 
+    <update id="updateItemDescribe">
+        update t_item
+        set `describe`=#{describe}
+        where id = #{id}
+    </update>
+
     <delete id="delItemByGroupId">
         delete
         from t_item
@@ -114,14 +120,14 @@
     </select>
 
     <select id="getItemListByGroupId" resultType="com.judong.chuanyiserver.entity.Item">
-        select id, item_group_id, item_name, node_index, node_identifier, data_type
+        select id, item_group_id, item_name, node_index, node_identifier, data_type, `describe`
         from t_item
         where item_group_id = #{itemGroupId}
         order by item_name
     </select>
 
     <select id="getPublicItemList" resultType="com.judong.chuanyiserver.entity.Item">
-        select id, item_group_id, item_name, node_index, node_identifier, data_type
+        select id, item_group_id, item_name, node_index, node_identifier, data_type,`describe`
         from t_item
         where item_group_id=#{itemGroupId} and
         item_name in

+ 5 - 0
chuanyi_server/src/main/resources/mapper/ReportTableDao.xml

@@ -0,0 +1,5 @@
+<?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.judong.chuanyiserver.dao.ReportTableDao">
+
+</mapper>

+ 39 - 1
chuanyi_server/src/main/resources/mapper/RoleDao.xml

@@ -46,13 +46,15 @@
                role_code
         FROM sys_role
         WHERE role_name = #{roleName}
+        and is_delete !=1
     </select>
 
     <select id="getRoleByNoIdName" resultType="com.judong.chuanyiserver.entity.Role">
         select id, role_name
         from sys_role
         where id != #{id}
-          and role_name = #{roleName}
+        and role_name = #{roleName}
+        and is_delete !=1
     </select>
 
     <select id="getRoleCount" resultType="java.lang.Long">
@@ -185,4 +187,40 @@
         </foreach>)
     </delete>
 
+    <select id="queryNotRoleAndMenu" resultType="com.judong.chuanyiserver.entity.Menu">
+        SELECT id,parent_id,menu_name,menu_url,menu_icon,sort_num,menu_status,update_time FROM sys_menu WHERE id NOT IN
+        (SELECT menu_id from sys_role_menu WHERE role_id=#{roleId})
+        and menu_status=1
+        ORDER BY sort_num ASC
+        LIMIT #{page},#{num}
+    </select>
+
+    <select id="queryNotRoleAndMenuNum" resultType="java.lang.Integer">
+        SELECT count(*) FROM sys_menu WHERE id NOT IN
+        (SELECT menu_id from sys_role_menu WHERE role_id=#{roleId})
+        and menu_status=1
+    </select>
+
+    <select id="queryRoleAndMenuIdPage" resultType="com.judong.chuanyiserver.entity.Menu">
+        SELECT id,parent_id,menu_name,menu_url,menu_icon,sort_num,menu_status,update_time FROM sys_menu WHERE id  IN
+        (SELECT menu_id from sys_role_menu WHERE role_id=#{roleId})
+        and menu_status=1
+        ORDER BY sort_num ASC
+        LIMIT #{page},#{num}
+    </select>
+
+    <select id="queryRoleAndMenuIdNum" resultType="java.lang.Integer">
+        SELECT count(*) FROM sys_menu WHERE id  IN
+        (SELECT menu_id from sys_role_menu WHERE role_id=#{roleId})
+        and menu_status=1
+    </select>
+
+    <select id="queryRoleAndMenuListId" resultType="java.lang.Integer">
+        SELECT menu_id from sys_role_menu WHERE role_id=#{roleId} ORDER BY menu_id ASC
+    </select>
+
+    <delete id="deleteUserRoleByUserId">
+        delete from sys_user_role where user_id=#{userId}
+    </delete>
+
 </mapper>

+ 19 - 0
chuanyi_server/src/main/resources/mapper/UserDao.xml

@@ -153,6 +153,7 @@
         from sys_user
         where user_id != #{userId}
           and user_name = #{userName}
+          and state !=2
     </select>
 
     <select id="getUserListByRoleIdCount" resultType="java.lang.Long">
@@ -225,6 +226,24 @@
         where user_id = #{user.userId}
     </update>
 
+    <select id="queryUserName" resultType="java.lang.Integer">
+        SELECT count(*) FROM sys_user WHERE BINARY user_name=#{name} and state!=2
+    </select>
+
+    <select id="getUserByNamePassByUpdate" resultType="com.judong.chuanyiserver.entity.User">
+        SELECT user_id,
+               user_name,
+               PASSWORD,
+               user_type,
+               create_time,
+               last_login_time,
+               state
+        FROM sys_user
+        WHERE BINARY user_name = #{userName}
+          and password = #{password}
+          and state!=2
+    </select>
+