Browse Source

Merge remote-tracking branch 'origin/dev' into dev

wangmh 8 years ago
parent
commit
00b0f30692
28 changed files with 1376 additions and 71 deletions
  1. 1 1
      gradle/persist-publish.gradle
  2. 5 16
      sso-manage-console-web/src/App.vue
  3. 4 0
      sso-manage-console-web/src/components/accounts/AccountIndex.vue
  4. 19 0
      sso-manage-console-web/src/components/accounts/enterprises/EnterpriseAdmin.vue
  5. 78 0
      sso-manage-console-web/src/components/accounts/enterprises/EnterpriseBaseAction.vue
  6. 165 0
      sso-manage-console-web/src/components/accounts/enterprises/EnterpriseBasicInfo.vue
  7. 121 46
      sso-manage-console-web/src/components/accounts/enterprises/EnterpriseHome.vue
  8. 165 0
      sso-manage-console-web/src/components/accounts/enterprises/EnterpriseMembers.vue
  9. 9 1
      sso-manage-console-web/src/components/accounts/enterprises/index.js
  10. 236 0
      sso-manage-console-web/src/components/accounts/users/UserBasicInfo.vue
  11. 40 4
      sso-manage-console-web/src/components/accounts/users/UserHome.vue
  12. 3 1
      sso-manage-console-web/src/components/accounts/users/index.js
  13. 60 2
      sso-manage-console-web/src/router/index.js
  14. BIN
      sso-manage-console-web/static/images/go_back.png
  15. BIN
      sso-manage-console-web/static/images/loc.png
  16. BIN
      sso-manage-console-web/static/images/look.png
  17. BIN
      sso-manage-console-web/static/images/pic.png
  18. BIN
      sso-manage-console-web/static/images/status/right.png
  19. BIN
      sso-manage-console-web/static/images/status/wrong.png
  20. 26 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/AuthenticationUtils.java
  21. 9 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/api/UserManageController.java
  22. 21 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/api/UserSpaceManageController.java
  23. 124 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/dto/UpdateSpaceInfo.java
  24. 182 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/dto/UpdateUserInfo.java
  25. 3 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/service/UserService.java
  26. 6 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/service/UserSpaceService.java
  27. 33 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/service/impl/UserServiceImpl.java
  28. 66 0
      sso-manage-console/src/main/java/com/uas/sso/sso/backend/service/impl/UserSpaceServiceImpl.java

+ 1 - 1
gradle/persist-publish.gradle

@@ -20,7 +20,7 @@ task persistJar(type: Jar) {
     baseName "sso-persist"
     from sourceSets.main.output
     exclude "spring", "config"
-    include "**/entity/**", "**/dao/**"
+    include "**/entity/**", "**/dao/**", "**/core/**"
 }
 
 task persistSourcesJar(type: Jar) {

+ 5 - 16
sso-manage-console-web/src/App.vue

@@ -1,17 +1,6 @@
 <template>
   <div id="app">
     <nav-header></nav-header>
-
-    <!--<div class="container">
-      <div class="row">
-        <div class="col-lg-2">
-          ABC
-        </div>
-        <div class="col-lg-10">
-          1234
-        </div>
-      </div>
-    </div>-->
     <router-view></router-view>
   </div>
 </template>
@@ -21,11 +10,11 @@
   import {NavHeader} from '@/components/common'
 
   export default {
-  name: 'app',
-  components: {
-    NavBar,
-    NavHeader
-  }
+    name: 'app',
+    components: {
+      NavBar,
+      NavHeader
+    }
 }
 </script>
 

+ 4 - 0
sso-manage-console-web/src/components/accounts/AccountIndex.vue

@@ -22,7 +22,11 @@
 </script>
 
 <style scoped>
+  .row {
+    background-color: #303743;
+  }
   .main-content {
     padding: 0;
+    background-color: #FFFFFF;
   }
 </style>

+ 19 - 0
sso-manage-console-web/src/components/accounts/enterprises/EnterpriseAdmin.vue

@@ -0,0 +1,19 @@
+<template>
+  <div>
+    124
+  </div>
+</template>
+
+<script>
+  export default {
+    name: 'enterprise-admin'
+  }
+</script>
+
+<style scoped>
+
+</style>
+
+<style>
+
+</style>

+ 78 - 0
sso-manage-console-web/src/components/accounts/enterprises/EnterpriseBaseAction.vue

@@ -0,0 +1,78 @@
+<template>
+  <div style="min-height: 570px;">
+    <div>
+      <ul class="nav nav-tabs">
+        <li @click="$router.go(-1)">
+          <img src="/static/images/go_back.png" alt="GoBack"/>
+        </li>
+        <router-link tag="li" active-class="active" :to="{name: 'EnterpriseBasicInfo'}" exact>
+          <a>基本信息</a><span class="triangle"></span></router-link>
+        <router-link tag="li" active-class="active" :to="{name: 'EnterpriseMembers'}" exact>
+          <a>成员管理</a><span class="triangle"></span></router-link>
+        <router-link tag="li" active-class="active" :to="{name: 'EnterpriseAdmin'}" exact><a>管理员信息</a><span
+          class="triangle"></span></router-link>
+        <router-link tag="li" active-class="active" :to="{name: 'EnterpriseAuth'}" exact>
+          <a>认证信息</a><span class="triangle"></span></router-link>
+        <router-link tag="li" active-class="active" :to="{name: 'EnterpriseApps'}" exact>
+          <a>应用管理</a><span class="triangle"></span></router-link>
+      </ul>
+    </div>
+
+    <router-view></router-view>
+  </div>
+</template>
+
+<script>
+  export default {
+    name: 'common-menu'
+  }
+</script>
+
+<style scoped>
+  .nav-tabs {
+    background-color: #E6EDF1;
+  }
+  .nav-tabs>li {
+    height: 60px;
+  }
+  .nav-tabs>li>img {
+    margin: 13px 38px 13px 14px;
+
+    cursor: pointer;
+  }
+  .nav-tabs>li>a {
+    margin: 13px 0;
+    border: none;
+    height: 34px;
+    padding: 9px 8px;
+    line-height: 14px;
+    background: none;
+
+    color: #646464;
+    font-size: 14px;
+    font-family: "Microsoft YaHei", sans-serif;
+  }
+  .nav-tabs>li.active>a {
+    color: #323232;
+    font-weight: bold;
+  }
+  .nav-tabs>li.active>a,
+  .nav-tabs>li.active>a:focus,
+  .nav-tabs>li.active>a:hover {
+    cursor: pointer;
+    border: none;
+    background: none;
+  }
+  .nav-tabs>li.active .triangle{
+    position: absolute;
+    width: 24px;
+    height: 12px;
+    border-right: 12px solid transparent;
+    border-left: 12px solid transparent;
+    border-bottom: 12px solid #FFFFFF;
+    z-index: 99;
+    bottom: 0;
+    left: 50%;
+    margin-left: -12px;
+  }
+</style>

+ 165 - 0
sso-manage-console-web/src/components/accounts/enterprises/EnterpriseBasicInfo.vue

@@ -0,0 +1,165 @@
+<template>
+  <div class="basic-enterprise-info" style="padding: 30px 0 0;width: 490px;">
+    <el-form ref="form" :model="enterpriseInfo" label-width="150px">
+      <el-form-item label="企业UU">
+        <div>{{ enterpriseInfo.spaceUU }}</div>
+      </el-form-item>
+      <el-form-item label="企业名称">
+        <el-input v-model="enterpriseInfo.spaceName"></el-input>
+      </el-form-item>
+      <el-form-item label="法定代表人">
+        <el-input v-model="enterpriseInfo.corporation">
+          <div slot="append" v-if="enterpriseInfo.corporation">
+            <img src="/static/images/status/right.png" alt="Status">
+          </div>
+          <div slot="append" v-if="!enterpriseInfo.corporation">
+            <img src="/static/images/status/wrong.png" alt="Status">
+          </div>
+        </el-input>
+
+      </el-form-item>
+      <el-form-item label="营业执照号">
+        <el-input v-model="enterpriseInfo.businessCode"></el-input>
+      </el-form-item>
+      <el-form-item label="营业执照附件">
+        <el-input v-model="enterpriseInfo.businessCodeImage">
+          <i class="el-input__icon" slot="prefix" style="line-height: 14px;margin-left: 10px;">
+            <img src="/static/images/pic.png" alt="Picture">
+          </i>
+          <i class="el-input__icon" slot="suffix" style="line-height: 12px;">
+            <img src="/static/images/look.png" alt="Look">
+          </i>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="企业地址">
+        <el-input v-model="enterpriseInfo.companyAddress" :readonly="true">
+          <i class="el-input__icon" slot="prefix" style="line-height: 16px;margin-left: 10px;">
+            <img src="/static/images/loc.png" alt="Location">
+          </i>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="认证状态" width="400">
+        <el-select v-model="enterpriseInfo.validCode" placeholder="请选择认证状态">
+          <el-option label="未认证" :value="0"></el-option>
+          <el-option label="申诉中" :value="1"></el-option>
+          <el-option label="已认证" :value="2"></el-option>
+          <el-option label="未通过" :value="3"></el-option>
+        </el-select>
+        <span style="padding-left: 8px;">
+            <img src="/static/images/status/right.png" alt="Status" v-if="enterpriseInfo.validCode === 2">
+            <img src="/static/images/status/wrong.png" alt="Status" v-if="enterpriseInfo.validCode !== 2">
+          </span>
+      </el-form-item>
+      <el-form-item label="注册时间">
+        <!-- TODO 注册时间 -->
+        <div v-text="enterpriseInfo.registerDate">2017-06-11 12:51:44</div>
+      </el-form-item>
+      <el-form-item>
+        <div class="action-form-item">
+          <el-button type="primary" @click="onSubmit">保存修改</el-button>
+        </div>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+  import _ from 'lodash'
+  import axios from '@/assets/js/axios'
+
+  export default {
+    name: 'enterprise-basic-info',
+    data () {
+      return {
+        enterpriseInfo: {}
+      }
+    },
+    methods: {
+      onSubmit () {
+        const data = _.pick(this.enterpriseInfo,
+          [
+            'spaceUU',
+            'spaceName',
+            'corporation',
+            'businessCode',
+            'businessCodeImage',
+            'companyAddress',
+            'validCode'
+          ]
+        )
+
+        const success = () => {
+          this.isChange = false
+          this.$message.success('保存成功')
+          this.$route.go(-1)
+        }
+        const error = error => {
+          this.$message.error(error)
+        }
+
+        axios.put('/api/user/space//modifySpaceInfo', data).then(success).catch(error)
+      }
+    },
+    mounted () {
+      this.enterpriseInfo = Object.assign({}, this.enterpriseInfo, this.$route.params)
+    }
+  }
+</script>
+
+<style scoped>
+  .action-form-item {
+    margin-left: -128px;
+    margin-top: 70px;
+  }
+  .action-form-item .el-button {
+    border-radius: 0;
+    padding: 10px 20px;
+  }
+  .el-button {
+    width: 120px;
+    height: 34px;
+  }
+  .el-button--primary {
+    background-color: #4E8EFC;
+    border-color: #4E8EFC;
+  }
+  .el-button--primary.is-disabled {
+    background-color: #D2D2D2;
+    border-color: #D2D2D2;
+  }
+</style>
+
+<style>
+  .basic-enterprise-info .el-input__inner {
+    height: 34px;
+    width: 340px;
+    border-radius: 0;
+  }
+  .basic-enterprise-info .el-form-item {
+    margin-bottom: 12px;
+  }
+  .basic-enterprise-info .el-form-item__label {
+    margin: 0;
+    height: 34px;
+    padding-left: 26px;
+    text-align: left;
+    line-height: 34px;
+
+    color: #000000;
+    font-size: 14px;
+    font-weight: normal;
+    font-family: "SimHei", sans-serif;
+  }
+  .basic-enterprise-info .el-form-item__content {
+    height: 34px;
+    line-height: 34px;
+  }
+  .basic-enterprise-info div.el-form-item:nth-last-child(3) .el-form-item__content {
+    width: 400px;
+  }
+  .basic-enterprise-info .el-input-group__append {
+    background: none;
+    border: none;
+    padding-left: 12px;
+  }
+</style>

+ 121 - 46
sso-manage-console-web/src/components/accounts/enterprises/EnterpriseHome.vue

@@ -1,10 +1,19 @@
 <template>
-  <common-home>
+  <common-home
+    :pageSize="pageParams.size"
+    :total="total"
+    :searchKeys="searchKeys"
+    :searchKey="pageParams.key"
+    :searchKeyword="pageParams.keyword"
+    @current-change="handleCurrentChange"
+    @refresh-data="handleRefreshData"
+    @search="handleSearchAction">
     <div slot="screen-type">
+      <!-- 认证状态 -->
       <label>认证状态</label>
-      <el-select v-model="value" placeholder="不限">
+      <el-select v-model="pageParams.validCode" clearable placeholder="不限" @change="handleRefreshData">
         <el-option
-          v-for="item in options"
+          v-for="item in validCodeOptions"
           :key="item.value"
           :label="item.label"
           :value="item.value">
@@ -13,9 +22,9 @@
 
       <!-- 注册来源 -->
       <label>注册来源</label>
-      <el-select v-model="value" placeholder="不限">
+      <el-select v-model="pageParams.fromApp" clearable placeholder="不限" @change="handleRefreshData">
         <el-option
-          v-for="item in options"
+          v-for="item in fromAppOptions"
           :key="item.value"
           :label="item.label"
           :value="item.value">
@@ -29,28 +38,68 @@
       style="width: 100%">
       <el-table-column
         label="操作"
-        width="130"
-        align="center">
+        width="120">
         <template slot-scope="scope">
           <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
         </template>
       </el-table-column>
       <el-table-column
-        prop="name"
-        label="姓名"
-        width="180">
+        prop="spaceName"
+        label="公司名称"
+        width="200">
       </el-table-column>
       <el-table-column
-        prop="address"
-        label="地址">
+        prop="validCode"
+        label="认证状态"
+        width="100">
+        <template slot-scope="scope">
+          <span v-if="scope.row.validCode === 0" style="padding-left: 8px;">未申请</span>
+          <span v-if="scope.row.validCode === 1" style="padding-left: 8px;">待认证</span>
+          <span v-if="scope.row.validCode === 2" style="padding-left: 8px;">已认证</span>
+          <span v-if="scope.row.validCode === 3" style="padding-left: 8px;">未通过</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        prop="admin"
+        label="管理员"
+        width="100">
+        <template slot-scope="scope" v-if="scope.row.admin && scope.row.admin.userUU">
+          <span v-text="scope.row.admin.vipName" style="padding-left: 8px;"></span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        prop="registerDate"
+        label="注册时间">
       </el-table-column>
     </el-table>
   </common-home>
 </template>
 
 <script>
+  import _ from 'lodash'
+  import axios from '@/assets/js/axios'
+  import {ValidCode} from '@/Constant'
   import CommonHome from '../common/CommonHome'
 
+  const fromApps = [
+    {
+      label: 'B2B',
+      value: 'b2b'
+    }, {
+      label: 'UAS',
+      value: 'uas'
+    }, {
+      label: '优软商城',
+      value: 'mall'
+    }
+  ]
+  const searchKeys = [
+    {
+      label: '企业名称',
+      value: 'spaceName'
+    }
+  ]
+
   export default {
     name: 'enterprise-home',
     components: {
@@ -58,40 +107,66 @@
     },
     data () {
       return {
-        tableData: [{
-          date: '查看',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '查看',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1517 弄'
-        }, {
-          date: '查看',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1519 弄'
-        }, {
-          date: '查看',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1516 弄'
-        }],
-        options: [{
-          value: '选项1',
-          label: '黄金糕'
-        }, {
-          value: '选项2',
-          label: '双皮奶'
-        }, {
-          value: '选项3',
-          label: '蚵仔煎'
-        }, {
-          value: '选项4',
-          label: '龙须面'
-        }, {
-          value: '选项5',
-          label: '北京烤鸭'
-        }],
-        value: ''
+        pageParams: {
+          page: 1,
+          size: 8,
+          validCode: null,
+          fromApp: null,
+          key: 'spaceName',
+          keyword: null
+        },
+        pageContent: [],
+        total: 0,
+        fromAppOptions: fromApps,
+        validCodeOptions: ValidCode,
+        searchKeys: searchKeys
+      }
+    },
+    created () {
+      this.fetchData()
+    },
+    computed: {
+      tableData () {
+        return this.pageContent
+      }
+    },
+    watch: {
+      '$route': 'fetchData'
+    },
+    methods: {
+      fetchData () {
+        const params = _.defaultsDeep({}, this.pageParams)
+        params.page = params.page - 1
+
+        const success = page => {
+          this.pageContent = page.content || []
+          this.total = page.totalElements
+        }
+        const error = response => {
+          this.$message.error(response)
+        }
+
+        axios.get('/api/user/space//showSpaceByPagination', { params }).then(success).catch(
+          error)
+      },
+      handleCurrentChange (currentPage) {
+        this.pageParams.page = currentPage
+        this.fetchData()
+      },
+      handleRefreshData () {
+        console.log(this.pageParams)
+        this.fetchData()
+      },
+      handleSearchAction (key, keyword) {
+        console.log(key, keyword)
+        this.pageParams.key = key
+        this.pageParams.keyword = keyword
+
+        this.fetchData()
+      },
+      handleClick (row) {
+        const routeLocation = {name: 'EnterpriseBasicInfo', params: row}
+        this.$router.push(routeLocation)
       }
     }
   }

+ 165 - 0
sso-manage-console-web/src/components/accounts/enterprises/EnterpriseMembers.vue

@@ -0,0 +1,165 @@
+<template>
+  <div class="basic-enterprise-info" style="padding: 30px 0 0;width: 490px;">
+    <el-form ref="form" :model="enterpriseInfo" label-width="150px">
+      <el-form-item label="企业UU">
+        <div>{{ enterpriseInfo.spaceUU }}</div>
+      </el-form-item>
+      <el-form-item label="企业名称">
+        <el-input v-model="enterpriseInfo.spaceName"></el-input>
+      </el-form-item>
+      <el-form-item label="法定代表人">
+        <el-input v-model="enterpriseInfo.corporation">
+          <div slot="append" v-if="enterpriseInfo.corporation">
+            <img src="/static/images/status/right.png" alt="Status">
+          </div>
+          <div slot="append" v-if="!enterpriseInfo.corporation">
+            <img src="/static/images/status/wrong.png" alt="Status">
+          </div>
+        </el-input>
+
+      </el-form-item>
+      <el-form-item label="营业执照号">
+        <el-input v-model="enterpriseInfo.businessCode"></el-input>
+      </el-form-item>
+      <el-form-item label="营业执照附件">
+        <el-input v-model="enterpriseInfo.businessCodeImage">
+          <i class="el-input__icon" slot="prefix" style="line-height: 14px;margin-left: 10px;">
+            <img src="/static/images/pic.png" alt="Picture">
+          </i>
+          <i class="el-input__icon" slot="suffix" style="line-height: 12px;">
+            <img src="/static/images/look.png" alt="Look">
+          </i>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="企业地址">
+        <el-input v-model="enterpriseInfo.companyAddress" :readonly="true">
+          <i class="el-input__icon" slot="prefix" style="line-height: 16px;margin-left: 10px;">
+            <img src="/static/images/loc.png" alt="Location">
+          </i>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="认证状态" width="400">
+        <el-select v-model="enterpriseInfo.validCode" placeholder="请选择认证状态">
+          <el-option label="未认证" :value="0"></el-option>
+          <el-option label="申诉中" :value="1"></el-option>
+          <el-option label="已认证" :value="2"></el-option>
+          <el-option label="未通过" :value="3"></el-option>
+        </el-select>
+        <span style="padding-left: 8px;">
+            <img src="/static/images/status/right.png" alt="Status" v-if="enterpriseInfo.validCode === 2">
+            <img src="/static/images/status/wrong.png" alt="Status" v-if="enterpriseInfo.validCode !== 2">
+          </span>
+      </el-form-item>
+      <el-form-item label="注册时间">
+        <!-- TODO 注册时间 -->
+        <div v-text="enterpriseInfo.registerDate">2017-06-11 12:51:44</div>
+      </el-form-item>
+      <el-form-item>
+        <div class="action-form-item">
+          <el-button type="primary" @click="onSubmit">保存修改</el-button>
+        </div>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+  import _ from 'lodash'
+  import axios from '@/assets/js/axios'
+
+  export default {
+    name: 'enterprise-basic-info',
+    data () {
+      return {
+        enterpriseInfo: {}
+      }
+    },
+    methods: {
+      onSubmit () {
+        const data = _.pick(this.enterpriseInfo,
+          [
+            'spaceUU',
+            'spaceName',
+            'corporation',
+            'businessCode',
+            'businessCodeImage',
+            'companyAddress',
+            'validCode'
+          ]
+        )
+
+        const success = () => {
+          this.isChange = false
+          this.$message.success('保存成功')
+          this.$route.go(-1)
+        }
+        const error = error => {
+          this.$message.error(error)
+        }
+
+        axios.put('/api/user/space//modifySpaceInfo', data).then(success).catch(error)
+      }
+    },
+    mounted () {
+      this.enterpriseInfo = Object.assign({}, this.enterpriseInfo, this.$route.params)
+    }
+  }
+</script>
+
+<style scoped>
+  .action-form-item {
+    margin-left: -128px;
+    margin-top: 70px;
+  }
+  .action-form-item .el-button {
+    border-radius: 0;
+    padding: 10px 20px;
+  }
+  .el-button {
+    width: 120px;
+    height: 34px;
+  }
+  .el-button--primary {
+    background-color: #4E8EFC;
+    border-color: #4E8EFC;
+  }
+  .el-button--primary.is-disabled {
+    background-color: #D2D2D2;
+    border-color: #D2D2D2;
+  }
+</style>
+
+<style>
+  .basic-enterprise-info .el-input__inner {
+    height: 34px;
+    width: 340px;
+    border-radius: 0;
+  }
+  .basic-enterprise-info .el-form-item {
+    margin-bottom: 12px;
+  }
+  .basic-enterprise-info .el-form-item__label {
+    margin: 0;
+    height: 34px;
+    padding-left: 26px;
+    text-align: left;
+    line-height: 34px;
+
+    color: #000000;
+    font-size: 14px;
+    font-weight: normal;
+    font-family: "SimHei", sans-serif;
+  }
+  .basic-enterprise-info .el-form-item__content {
+    height: 34px;
+    line-height: 34px;
+  }
+  .basic-enterprise-info div.el-form-item:nth-last-child(3) .el-form-item__content {
+    width: 400px;
+  }
+  .basic-enterprise-info .el-input-group__append {
+    background: none;
+    border: none;
+    padding-left: 12px;
+  }
+</style>

+ 9 - 1
sso-manage-console-web/src/components/accounts/enterprises/index.js

@@ -1,5 +1,13 @@
 import EnterpriseHome from './EnterpriseHome'
+import EnterpriseBasicInfo from './EnterpriseBasicInfo'
+import EnterpriseMembers from './EnterpriseMembers'
+import EnterpriseAdmin from './EnterpriseAdmin'
+import EnterpriseBaseAction from './EnterpriseBaseAction'
 
 export {
-  EnterpriseHome
+  EnterpriseHome,
+  EnterpriseBasicInfo,
+  EnterpriseMembers,
+  EnterpriseAdmin,
+  EnterpriseBaseAction
 }

+ 236 - 0
sso-manage-console-web/src/components/accounts/users/UserBasicInfo.vue

@@ -0,0 +1,236 @@
+<template>
+  <div style="min-height: 570px;">
+    <div>
+      <ul class="nav nav-tabs">
+        <li @click="$router.go(-1)">
+          <img src="/static/images/go_back.png" alt="GoBack"/>
+        </li>
+        <li role="presentation" class="active"><a>基本信息</a><span class="triangle"></span></li>
+      </ul>
+    </div>
+    <div class="basic-user-info" style="padding: 30px 0 0;width: 490px;">
+      <el-form ref="form" :model="userInfo" label-width="150px">
+        <el-form-item label="个人UU">
+          <div>{{ userInfo.userUU }}</div>
+        </el-form-item>
+        <el-form-item label="个人名称">
+          <el-input v-model="userInfo.vipName"></el-input>
+        </el-form-item>
+        <el-form-item label="手机号">
+          <el-input v-model="userInfo.mobile"></el-input>
+        </el-form-item>
+        <el-form-item label="手机认证">
+          <el-select v-model="userInfo.mobileValidCode" placeholder="请选择认证状态">
+            <el-option label="已认证" :value="2"></el-option>
+            <el-option label="未认证" :value="0"></el-option>
+            <el-option label="申诉中" :value="1"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="邮箱">
+          <el-input v-model="userInfo.email"></el-input>
+        </el-form-item>
+        <el-form-item label="邮箱认证">
+          <el-select v-model="userInfo.emailValidCode" width="340" placeholder="请选择认证状态">
+            <el-option label="已认证" :value="2"></el-option>
+            <el-option label="未认证" :value="0"></el-option>
+            <el-option label="申诉中" :value="1"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="密码">
+          <el-input type="password" v-model="userInfo.password" auto-complete="off"></el-input>
+        </el-form-item>
+        <el-form-item label="账号冻结">
+          <el-select v-model="userInfo.lock" placeholder="请选择是否冻结账号">
+            <el-option label="是" :value="1"></el-option>
+            <el-option label="否" :value="0"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="真实姓名">
+          <el-input v-model="userInfo.realName"></el-input>
+        </el-form-item>
+        <el-form-item label="身份证号">
+          <el-input v-model="userInfo.idCard"></el-input>
+        </el-form-item>
+        <el-form-item label="实名认证">
+          <el-select v-model="userInfo.identityValidCode" placeholder="请选择认证状态">
+            <el-option label="已认证" :value="2"></el-option>
+            <el-option label="未认证" :value="0"></el-option>
+            <el-option label="待认证" :value="1"></el-option>
+            <el-option label="未通过" :value="3"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="注册时间">
+          <!-- TODO 注册时间 -->
+          <div>2017-06-11 12:51:44</div>
+        </el-form-item>
+        <el-form-item label="上次登录">
+          <!-- TODO 上次登录 -->
+          <div>2017-06-11 12:51:44</div>
+        </el-form-item>
+        <el-form-item label="注册来源">
+          <div>{{ userInfo.fromApp }}</div>
+        </el-form-item>
+        <el-form-item>
+          <div class="action-form-item">
+            <el-button type="primary" @click="onSubmit" :disabled="!isChange">保存修改</el-button>
+            <el-button @click="$router.go(-1)">返回</el-button>
+          </div>
+        </el-form-item>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script>
+  import _ from 'lodash'
+  import axios from '@/assets/js/axios'
+
+  export default {
+    name: 'user-basic-info',
+    data () {
+      return {
+        userInfo: {},
+        isChange: false
+      }
+    },
+    methods: {
+      onSubmit () {
+        const data = _.pick(this.userInfo,
+          [
+            'userUU',
+            'vipName',
+            'mobile',
+            'mobileValidCode',
+            'email',
+            'emailValidCode',
+            'password',
+            'lock',
+            'realName',
+            'idCard',
+            'identityValidCode'
+          ]
+        )
+
+        const success = () => {
+          this.isChange = false
+          this.$message.success('保存成功')
+          this.$route.go(-1)
+        }
+        const error = error => {
+          this.$message.error(error)
+        }
+
+        axios.put('/api/user//modifyUserInfo', data).then(success).catch(error)
+      }
+    },
+    mounted () {
+      this.userInfo = Object.assign({}, this.userInfo, this.$route.params)
+    },
+    watch: {
+      userInfo: {
+        // 监听对象属性变化,触发激活保存修改按钮的行为
+        handler (newValue, oldValue) {
+          if (oldValue.userUU) {
+            this.isChange = !_.isEqual(newValue, this.$route.params)
+          }
+        },
+        deep: true
+      }
+    }
+  }
+</script>
+
+<style scoped>
+  .nav-tabs {
+    background-color: #E6EDF1;
+  }
+  .nav-tabs>li {
+    height: 60px;
+  }
+  .nav-tabs>li>img {
+    margin: 13px 38px 13px 14px;
+
+    cursor: pointer;
+  }
+  .nav-tabs>li>a {
+    margin: 13px 0;
+    border: none;
+    height: 34px;
+    padding: 9px 8px;
+    line-height: 14px;
+    background: none;
+
+    color: #646464;
+    font-size: 14px;
+    font-family: "Microsoft YaHei", sans-serif;
+  }
+  .nav-tabs>li.active>a {
+    color: #323232;
+    font-weight: bold;
+  }
+  .nav-tabs>li.active>a,
+  .nav-tabs>li.active>a:focus,
+  .nav-tabs>li.active>a:hover {
+    cursor: pointer;
+    border: none;
+    background: none;
+  }
+  .nav-tabs>li.active .triangle{
+    position: absolute;
+    width: 24px;
+    height: 12px;
+    border-right: 12px solid transparent;
+    border-left: 12px solid transparent;
+    border-bottom: 12px solid #FFFFFF;
+    z-index: 99;
+    bottom: 0;
+    left: 50%;
+    margin-left: -12px;
+  }
+  .action-form-item {
+    margin-left: -128px;
+  }
+  .action-form-item .el-button {
+    border-radius: 0;
+    padding: 10px 20px;
+  }
+  .el-button {
+    width: 120px;
+    height: 34px;
+  }
+  .el-button--primary {
+    background-color: #4E8EFC;
+    border-color: #4E8EFC;
+  }
+  .el-button--primary.is-disabled {
+    background-color: #D2D2D2;
+    border-color: #D2D2D2;
+  }
+</style>
+
+<style>
+  .basic-user-info .el-input__inner {
+    height: 34px;
+    width: 340px;
+    border-radius: 0;
+  }
+  .basic-user-info .el-form-item {
+    margin-bottom: 12px;
+  }
+  .basic-user-info .el-form-item__label {
+    margin: 0;
+    height: 34px;
+    padding-left: 26px;
+    text-align: left;
+    line-height: 34px;
+
+    color: #000000;
+    font-size: 14px;
+    font-weight: normal;
+    font-family: "SimHei", sans-serif;
+  }
+  .basic-user-info .el-form-item__content {
+    height: 34px;
+    line-height: 34px;
+  }
+</style>

+ 40 - 4
sso-manage-console-web/src/components/accounts/users/UserHome.vue

@@ -43,7 +43,7 @@
         </template>
       </el-table-column>
       <el-table-column
-        prop="realName"
+        prop="vipName"
         label="用户名称">
       </el-table-column>
       <el-table-column
@@ -72,7 +72,9 @@
       </el-table-column>
       <el-table-column
         prop="registerDate"
-        label="注册时间">
+        label="注册时间"
+        :formatter="formatDate"
+        width="160">
       </el-table-column>
       <el-table-column
         prop="lastLogin"
@@ -107,7 +109,7 @@
   const searchKeys = [
     {
       label: '用户名称',
-      value: 'realName'
+      value: 'vipName'
     }
   ]
 
@@ -123,7 +125,7 @@
           size: 8,
           fromApp: null,
           mobileValidCode: null,
-          key: 'realName',
+          key: 'vipName',
           keyword: null
         },
         pageContent: [],
@@ -174,6 +176,40 @@
         this.pageParams.keyword = keyword
 
         this.fetchData()
+      },
+      handleClick (row) {
+        const routeLocation = {name: 'UserBasicInfo', params: row}
+        this.$router.push(routeLocation)
+      },
+      formatDate (row, column, value) {
+        if (!value) {
+          return ''
+        }
+
+        const date = new Date(value)
+        let str = ''
+        str += date.getFullYear() + '-'
+        if (date.getMonth() + 1 < 10) {
+          str += '0'
+        }
+        str += (date.getMonth() + 1) + '-'
+        if (date.getDate() < 10) {
+          str += '0'
+        }
+        str += date.getDate() + ' '
+        if (date.getHours() < 10) {
+          str += '0'
+        }
+        str += date.getHours() + ':'
+        if (date.getMinutes() < 10) {
+          str += '0'
+        }
+        str += date.getMinutes() + ':'
+        if (date.getSeconds() < 10) {
+          str += '0'
+        }
+        str += date.getSeconds()
+        return str
       }
     }
   }

+ 3 - 1
sso-manage-console-web/src/components/accounts/users/index.js

@@ -1,5 +1,7 @@
 import UserHome from './UserHome'
+import UserBasicInfo from './UserBasicInfo'
 
 export {
-  UserHome
+  UserHome,
+  UserBasicInfo
 }

+ 60 - 2
sso-manage-console-web/src/router/index.js

@@ -10,8 +10,11 @@ import AssetHome from '@/components/asset/AssetHome'
 import SettingsHome from '@/components/settings/SettingsHome'
 import {BackHome} from '@/components/back'
 import AccountIndex from '@/components/accounts/AccountIndex'
-import {EnterpriseHome} from '@/components/accounts/enterprises'
-import {UserHome} from '@/components/accounts/users'
+import {
+  EnterpriseAdmin, EnterpriseBaseAction, EnterpriseBasicInfo,
+  EnterpriseHome, EnterpriseMembers
+} from '@/components/accounts/enterprises'
+import {UserBasicInfo, UserHome} from '@/components/accounts/users'
 import {AppealHome} from '@/components/accounts/appeals'
 
 Vue.use(Router)
@@ -37,11 +40,66 @@ export default new Router({
           name: 'EnterpriseHome',
           component: EnterpriseHome
         },
+        {
+          path: 'enterprise',
+          component: EnterpriseBaseAction,
+          beforeEnter: (to, from, next) => {
+            const enterpriseInfo = to.params
+            if (enterpriseInfo.spaceUU) {
+              next()
+            } else {
+              next({ name: 'EnterpriseHome' })
+            }
+          },
+          children: [
+            {
+              // 企业基本信息
+              path: 'basic',
+              name: 'EnterpriseBasicInfo',
+              component: EnterpriseBasicInfo
+            },
+            {
+              // 企业成员管理
+              path: 'members',
+              name: 'EnterpriseMembers',
+              component: EnterpriseMembers
+            },
+            {
+              // 企业管理员信息
+              path: 'admin',
+              name: 'EnterpriseAdmin',
+              component: EnterpriseAdmin
+            },
+            {
+              // 企业认证信息
+              path: 'auth',
+              name: 'EnterpriseAuth'
+            },
+            {
+              // 企业应用管理
+              path: 'apps',
+              name: 'EnterpriseApps'
+            }
+          ]
+        },
         {
           path: 'user',
           name: 'UserHome',
           component: UserHome
         },
+        {
+          path: 'user/basic',
+          name: 'UserBasicInfo',
+          component: UserBasicInfo,
+          beforeEnter: (to, from, next) => {
+            const userInfo = to.params
+            if (userInfo.userUU) {
+              next()
+            } else {
+              next({ name: 'UserHome' })
+            }
+          }
+        },
         {
           path: 'appeal',
           name: 'AppealHome',

BIN
sso-manage-console-web/static/images/go_back.png


BIN
sso-manage-console-web/static/images/loc.png


BIN
sso-manage-console-web/static/images/look.png


BIN
sso-manage-console-web/static/images/pic.png


BIN
sso-manage-console-web/static/images/status/right.png


BIN
sso-manage-console-web/static/images/status/wrong.png


+ 26 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/AuthenticationUtils.java

@@ -0,0 +1,26 @@
+package com.uas.sso.sso.backend;
+
+import com.uas.sso.common.encrypt.MD5;
+import com.uas.sso.core.Const;
+import com.uas.sso.exception.AccountException;
+import org.springframework.util.StringUtils;
+
+public class AuthenticationUtils {
+
+    public static String getEncryPassword(String format, String noEncryPwd, String salt) {
+        if (StringUtils.isEmpty(format)) {
+            return noEncryPwd;
+        }
+        // 超过32认为是已加密过的密文
+        if (noEncryPwd.length() >= 32) {
+            /// 之后添加日志时恢复
+            //logger.error("用户密码加密", String.format("传递过来的密码(%s)必须是未加密的明文", noEncryPwd));
+            throw new AccountException("invalid password");
+        }
+        // $password{$salt}
+        String password = format.replace(Const.ENCRY_PARAM_PASSWORD, noEncryPwd);
+        password = password.replace(Const.ENCRY_PARAM_SALT, salt == null ? "" : salt);
+        return MD5.toMD5(password);
+    }
+
+}

+ 9 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/api/UserManageController.java

@@ -2,6 +2,7 @@ package com.uas.sso.sso.backend.api;
 
 import com.uas.sso.entity.User;
 import com.uas.sso.entity.Userspace;
+import com.uas.sso.sso.backend.dto.UpdateUserInfo;
 import com.uas.sso.sso.backend.service.UserService;
 import com.uas.sso.sso.backend.support.ResultBean;
 import java.util.Set;
@@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -56,4 +58,11 @@ public class UserManageController {
 
         return new ResultBean<>(userService.findSpacesByUser(userUu));
     }
+
+    @RequestMapping(method = RequestMethod.PUT, path = "//modifyUserInfo",
+            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public ResultBean<Boolean> modifyUserInfo(@RequestBody UpdateUserInfo userInfo) {
+
+        return new ResultBean<>(userService.modifyUserInfo(userInfo));
+    }
 }

+ 21 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/api/UserSpaceManageController.java

@@ -1,12 +1,14 @@
 package com.uas.sso.sso.backend.api;
 
 import com.uas.sso.entity.Userspace;
+import com.uas.sso.sso.backend.dto.UpdateSpaceInfo;
 import com.uas.sso.sso.backend.service.UserSpaceService;
 import com.uas.sso.sso.backend.support.ResultBean;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -30,6 +32,25 @@ public class UserSpaceManageController {
 
     @RequestMapping(method = RequestMethod.GET, path = "//showSpaceByPagination",
             produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public ResultBean<org.springframework.data.domain.Page<Userspace>> showSpaceByPagination(Pageable page,
+            @RequestParam(required = false) Short validCode,
+            @RequestParam(required = false) String fromApp,
+            @RequestParam(required = false) String key,
+            @RequestParam(required = false) String keyword) {
+
+        return new ResultBean<>(spaceService.showSpaceByPagination(page, validCode, fromApp, key, keyword));
+    }
+
+    @RequestMapping(method = RequestMethod.PUT, path = "//modifySpaceInfo",
+            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public ResultBean<Boolean> modifyUserInfo(@RequestBody UpdateSpaceInfo spaceInfo) {
+
+        return new ResultBean<>(spaceService.modifyUserInfo(spaceInfo));
+    }
+
+    @Deprecated
+    @RequestMapping(method = RequestMethod.GET, path = "//showSpaceByPaginationOld",
+            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public ResultBean<org.springframework.data.domain.Page<Userspace>> showUserByPagination(Pageable page,
             Short validCode,
             @RequestParam(required = false) String spaceName,

+ 124 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/dto/UpdateSpaceInfo.java

@@ -0,0 +1,124 @@
+package com.uas.sso.sso.backend.dto;
+
+import com.uas.sso.entity.Userspace;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 企业实体 DTO
+ *
+ * @author huxz
+ */
+@SuppressWarnings("unused")
+public class UpdateSpaceInfo {
+
+    /**
+     * 企业uu号
+     */
+    @NotNull(message = "企业UU号不能为空")
+    @Min(value = 10000000, message = "企业UU格式不合法")
+    private Long spaceUU;
+
+    /**
+     * 企业名称
+     */
+    @NotNull(message = "企业名称不能为空")
+    private String spaceName;
+
+    /**
+     * 法定代表人
+     */
+    @NotNull(message = "法定代表人不能为空")
+    private String corporation;
+
+    /**
+     * 营业执照号
+     */
+    private String businessCode;
+
+    /**
+     * 营业执照
+     */
+    private String businessCodeImage;
+
+    /**
+     * 公司地址
+     */
+    private String companyAddress;
+
+    /**
+     * 企业信息认证状态
+     */
+    @NotNull(message = "企业信息认证状态不能为空")
+    private Short validCode;
+
+    public Long getSpaceUU() {
+        return spaceUU;
+    }
+
+    public void setSpaceUU(Long spaceUU) {
+        this.spaceUU = spaceUU;
+    }
+
+    public String getSpaceName() {
+        return spaceName;
+    }
+
+    public void setSpaceName(String spaceName) {
+        this.spaceName = spaceName;
+    }
+
+    public String getCorporation() {
+        return corporation;
+    }
+
+    public void setCorporation(String corporation) {
+        this.corporation = corporation;
+    }
+
+    public String getBusinessCode() {
+        return businessCode;
+    }
+
+    public void setBusinessCode(String businessCode) {
+        this.businessCode = businessCode;
+    }
+
+    public String getBusinessCodeImage() {
+        return businessCodeImage;
+    }
+
+    public void setBusinessCodeImage(String businessCodeImage) {
+        this.businessCodeImage = businessCodeImage;
+    }
+
+    public String getCompanyAddress() {
+        return companyAddress;
+    }
+
+    public void setCompanyAddress(String companyAddress) {
+        this.companyAddress = companyAddress;
+    }
+
+    public Short getValidCode() {
+        return validCode;
+    }
+
+    public void setValidCode(Short validCode) {
+        this.validCode = validCode;
+    }
+
+    public Userspace fillSpaceInfo(Userspace userspace) {
+        if (userspace == null) {
+            userspace = new Userspace();
+        }
+
+        userspace.setSpaceName(this.spaceName);
+        userspace.setCorporation(this.corporation);
+        userspace.setBusinessCode(this.businessCode);
+        userspace.setBusinessCodeImage(this.businessCodeImage);
+        userspace.setCompanyAddress(this.companyAddress);
+        userspace.setValidCode(this.validCode);
+        return userspace;
+    }
+}

+ 182 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/dto/UpdateUserInfo.java

@@ -0,0 +1,182 @@
+package com.uas.sso.sso.backend.dto;
+
+import com.uas.sso.entity.User;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 用户信息DTO.
+ *
+ * @author huxz
+ */
+public class UpdateUserInfo {
+
+    /**
+     * uu号
+     */
+    @NotNull(message = "用户UU号不能为空")
+    @Min(value = 10000, message = "用户UU格式不合法")
+    private Long userUU;
+
+    /**
+     * 会员名
+     */
+    @NotNull(message = "个人名称不能为空")
+    private String vipName;
+
+    /**
+     * 手机号
+     */
+    @NotNull(message = "用户手机号不能为空")
+    private String mobile;
+
+    /**
+     * 手机号认证状态
+     */
+    @NotNull(message = "手机认证状态不能为空")
+    private Short mobileValidCode;
+
+    /**
+     * 用户邮箱
+     */
+    private String email;
+
+    /**
+     * 用户邮箱认证状态
+     */
+    @NotNull(message = "邮箱认证状态不能为空")
+    private Short emailValidCode;
+
+    /**
+     * 用户密码
+     */
+    @NotNull(message = "用户密码不能为空")
+    private String password;
+
+    /**
+     * 账户是否冻结(1、冻结)
+     */
+    private Integer lock;
+
+    /**
+     * 用户真实姓名
+     */
+    private String realName;
+
+    /**
+     * 用户身份证号
+     */
+    private String idCard;
+
+    /**
+     * 用户身份认证状态
+     */
+    @NotNull(message = "用户身份认证状态不能为空")
+    private Short identityValidCode;
+
+    public Long getUserUU() {
+        return userUU;
+    }
+
+    public void setUserUU(Long userUU) {
+        this.userUU = userUU;
+    }
+
+    public String getVipName() {
+        return vipName;
+    }
+
+    public void setVipName(String vipName) {
+        this.vipName = vipName;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public Short getMobileValidCode() {
+        return mobileValidCode;
+    }
+
+    public void setMobileValidCode(Short mobileValidCode) {
+        this.mobileValidCode = mobileValidCode;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public Short getEmailValidCode() {
+        return emailValidCode;
+    }
+
+    public void setEmailValidCode(Short emailValidCode) {
+        this.emailValidCode = emailValidCode;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public Integer getLock() {
+        return lock;
+    }
+
+    public void setLock(Integer lock) {
+        this.lock = lock;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getIdCard() {
+        return idCard;
+    }
+
+    public void setIdCard(String idCard) {
+        this.idCard = idCard;
+    }
+
+    public Short getIdentityValidCode() {
+        return identityValidCode;
+    }
+
+    public void setIdentityValidCode(Short identityValidCode) {
+        this.identityValidCode = identityValidCode;
+    }
+
+    public User fillUserInfo(User user) {
+        if (user == null) {
+            user = new User();
+        }
+
+        user.setVipName(this.vipName);
+        user.setMobile(this.mobile);
+        user.setMobileValidCode(this.mobileValidCode);
+        user.setEmail(this.email);
+        user.setEmailValidCode(this.emailValidCode);
+        user.setPassword(this.password);
+        user.setLock(this.lock);
+        user.setRealName(this.realName);
+        user.setIdCard(this.idCard);
+        user.setIdentityValidCode(this.identityValidCode);
+        return user;
+    }
+}

+ 3 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/service/UserService.java

@@ -2,6 +2,7 @@ package com.uas.sso.sso.backend.service;
 
 import com.uas.sso.entity.User;
 import com.uas.sso.entity.Userspace;
+import com.uas.sso.sso.backend.dto.UpdateUserInfo;
 import java.util.List;
 import java.util.Set;
 import org.springframework.data.domain.Page;
@@ -22,4 +23,6 @@ public interface UserService {
 
     Page<User> showUserByPagination(Pageable page, String fromApp, Short mobileValidCode, String key,
             String keyword);
+
+    Boolean modifyUserInfo(UpdateUserInfo userInfo);
 }

+ 6 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/service/UserSpaceService.java

@@ -1,6 +1,7 @@
 package com.uas.sso.sso.backend.service;
 
 import com.uas.sso.entity.Userspace;
+import com.uas.sso.sso.backend.dto.UpdateSpaceInfo;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 
@@ -11,6 +12,11 @@ import org.springframework.data.domain.Pageable;
  */
 public interface UserSpaceService {
 
+    Page<Userspace> showSpaceByPagination(Pageable page, Short validCode, String fromApp, String key,
+            String keyword);
+
+    Boolean modifyUserInfo(UpdateSpaceInfo spaceInfo);
+
     Page<Userspace> showSpaceByPagination(Pageable page, String spaceName, String businessCode, Short validCode);
 
     void addUserToSpace(Long spaceUu, Long userUu);

+ 33 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/service/impl/UserServiceImpl.java

@@ -1,8 +1,11 @@
 package com.uas.sso.sso.backend.service.impl;
 
+import com.uas.sso.core.Const;
 import com.uas.sso.dao.UserDao;
 import com.uas.sso.entity.User;
 import com.uas.sso.entity.Userspace;
+import com.uas.sso.sso.backend.AuthenticationUtils;
+import com.uas.sso.sso.backend.dto.UpdateUserInfo;
 import com.uas.sso.sso.backend.exceptions.ValidationFailedException;
 import com.uas.sso.sso.backend.service.UserService;
 import java.util.ArrayList;
@@ -111,4 +114,34 @@ public class UserServiceImpl implements UserService {
             return null;
         }, page);
     }
+
+    @Override
+    public Boolean modifyUserInfo(UpdateUserInfo userInfo) {
+
+        User existUser = userDao.findOne(userInfo.getUserUU());
+        if (existUser == null) {
+            throw new ValidationFailedException(String.format("用户%d不存在", userInfo.getUserUU()));
+        }
+
+        // 如果个人名称被修改,则检测是否重名
+        if (!existUser.getVipName().equals(userInfo.getVipName())) {
+            List<User> userList = userDao.findByVipName(userInfo.getVipName());
+            if (!CollectionUtils.isEmpty(userList)) {
+                throw new ValidationFailedException(String.format("个人名称%s已注册", userInfo.getVipName()));
+            }
+        }
+
+        existUser = userInfo.fillUserInfo(existUser);
+
+        if (existUser.getPassword().length() < 32) {
+            String encryPassword = AuthenticationUtils
+                    .getEncryPassword(Const.ENCRY_FORMAT, existUser.getPassword(),
+                            existUser.getSalt());
+            existUser.setPassword(encryPassword);
+        }
+
+        userDao.save(existUser);
+        return true;
+    }
+
 }

+ 66 - 0
sso-manage-console/src/main/java/com/uas/sso/sso/backend/service/impl/UserSpaceServiceImpl.java

@@ -6,6 +6,7 @@ import com.uas.sso.dao.UserspaceDao;
 import com.uas.sso.entity.App;
 import com.uas.sso.entity.User;
 import com.uas.sso.entity.Userspace;
+import com.uas.sso.sso.backend.dto.UpdateSpaceInfo;
 import com.uas.sso.sso.backend.exceptions.ValidationFailedException;
 import com.uas.sso.sso.backend.service.UserSpaceService;
 import java.util.ArrayList;
@@ -41,6 +42,71 @@ public class UserSpaceServiceImpl implements UserSpaceService {
         this.appDao = appDao;
     }
 
+    @Override
+    public Page<Userspace> showSpaceByPagination(Pageable page, Short validCode, String fromApp,
+            String key, String keyword) {
+
+        return userspaceDao.findAll((root, query, builder) -> {
+            List<Predicate> predicates = new ArrayList<>();
+
+            if (!StringUtils.isEmpty(validCode)) {
+                Predicate predicate = builder.equal(root.get("validCode"), validCode);
+                predicates.add(predicate);
+            }
+
+            if (!StringUtils.isEmpty(fromApp)) {
+                Predicate predicate = builder.equal(root.get("fromApp"), fromApp);
+                predicates.add(predicate);
+            }
+
+            // 搜索关键字过滤
+            if (!StringUtils.isEmpty(key) && !StringUtils.isEmpty(keyword)) {
+                Predicate predicate = builder.like(root.get(key), "%" + keyword + "%");
+                predicates.add(predicate);
+            }
+
+            predicates.removeAll(Collections.singletonList(null));
+
+            Predicate[] array = new Predicate[predicates.size()];
+            predicates.toArray(array);
+            Predicate predicate = builder.and(array);
+            query.where(predicate);
+            return null;
+        }, page);
+    }
+
+    @Override
+    public Boolean modifyUserInfo(UpdateSpaceInfo spaceInfo) {
+        Userspace userspace = userspaceDao.findOne(spaceInfo.getSpaceUU());
+        if (userspace == null) {
+            throw new ValidationFailedException(String.format("UU%d对应企业不存在", spaceInfo.getSpaceUU()));
+        }
+
+        if (!userspace.getSpaceName().equals(spaceInfo.getSpaceName())) {
+            Userspace existSpace = userspaceDao.findBySpaceName(spaceInfo.getSpaceName());
+            if (existSpace != null) {
+                throw new ValidationFailedException(String.format("企业%s已注册", spaceInfo.getSpaceName()));
+            }
+        }
+
+        // 避免清空营业执照因唯一性约束导致报错
+        if (StringUtils.isEmpty(spaceInfo.getBusinessCode())) {
+            spaceInfo.setBusinessCode(null);
+        } else {
+            if (!spaceInfo.getBusinessCode().equals(userspace.getBusinessCode())) {
+                Userspace existSpace = userspaceDao.findByBusinessCode(spaceInfo.getBusinessCode());
+                if (existSpace != null) {
+                    throw new ValidationFailedException(String.format("营业执照%s已认证", spaceInfo.getBusinessCode()));
+                }
+            }
+        }
+
+        userspace = spaceInfo.fillSpaceInfo(userspace);
+
+        userspaceDao.save(userspace);
+        return true;
+    }
+
     @Override
     public Page<Userspace> showSpaceByPagination(Pageable page, String spaceName, String businessCode,
             Short validCode) {