浏览代码

Merge remote-tracking branch 'origin/master'

suntg 8 年之前
父节点
当前提交
251238ce0c

+ 18 - 8
src/main/java/com/uas/platform/home/controller/AccountController.java

@@ -1,16 +1,17 @@
 package com.uas.platform.home.controller;
 
-import java.io.IOException;
-
+import com.uas.account.entity.UuzcUserSpaceDetail;
+import com.uas.account.util.AccountUtils;
+import com.uas.platform.home.core.support.SystemSession;
+import com.uas.platform.home.web.BaseController;
+import com.uas.sso.SSOHelper;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 
-import com.uas.platform.home.core.support.SystemSession;
-import com.uas.platform.home.web.BaseController;
-import com.uas.sso.SSOHelper;
+import java.io.IOException;
 
 @Controller
 public class AccountController extends BaseController {
@@ -22,8 +23,17 @@ public class AccountController extends BaseController {
 	 */
 	@RequestMapping(value = "/account", method = RequestMethod.GET)
 	@ResponseBody
-	public ModelMap getAccountInfo() {
-		return success(SystemSession.getUser());
+	public ModelMap getAccountInfo() throws Exception {
+	    if(null != SystemSession.getUser()) {
+            ModelMap map = new ModelMap();
+	        UuzcUserSpaceDetail detail = AccountUtils.getUuzcUserSpaceDetail(SystemSession.getUser().getSpaceUID());
+            map.put("content", SystemSession.getUser());
+            if(null != detail) {
+                map.put("space", detail);
+            }
+            return map;
+        }
+	    return success();
 	}
 
 	/**
@@ -49,5 +59,5 @@ public class AccountController extends BaseController {
 		SSOHelper.clearLogin(request, response);
 		return success();
 	}
-
+    
 }

+ 34 - 22
src/main/java/com/uas/platform/home/controller/UuzcController.java

@@ -20,7 +20,7 @@ import java.util.List;
 
 /**
  * 关于优软众创的一些接口
- *
+ * <p>
  * Created by hejq on 2017-11-02.
  */
 @RestController
@@ -36,27 +36,28 @@ public class UuzcController extends BaseController {
     public ModelMap checkAccount() throws Exception {
         UserView user = SystemSession.getUser();
         ModelMap map = new ModelMap();
-        if(null != user) {
-            if ( null != user.getHr() && 1 == user.getHr()) {// hr账户
-                UuzcUserInfo info = getUserInfo(user, true);
+        UuzcUserSpaceDetail detail = AccountUtils.getUuzcUserSpaceDetail(user.getSpaceUID());
+        if (null != user) {
+            if (null != user.getHr() && 1 == user.getHr()) {// hr账户
+                UuzcUserInfo info = getUserInfo(user, detail, true);
                 map.put("ishr", true);
                 map.put("user", info);
                 map.put("usertype", "hr");
-            } else if(null != user.getUuzcUserSpaceDetail()) {// 先通过登录的信息判断是否是企业用户
+            } else if (null != detail) {// 先通过登录的信息判断是否是企业用户
                 map.put("usertype", "company");
-                UuzcUserInfo info = getUserInfo(user, true);
+                UuzcUserInfo info = getUserInfo(user, detail, true);
                 //判断是否设置了hr
                 String result = AccountUtils.getHrAccount(info.getLicense());
                 ResultInfo resInfo = JSONObject.parseObject(result, ResultInfo.class);
                 map.put("hr", resInfo.getExistHr() ? true : false);
-                if(user.getName().equals(user.getUuzcUserSpaceDetail().getAdminName())) {
+                if (user.getUid().equals(detail.getAdminTel())) {
                     map.put("manager", true);
                 } else {
-                    map.put("managerName", user.getUuzcUserSpaceDetail().getAdminName());
+                    map.put("managerName", detail.getAdminName());
                 }
                 map.put("user", info);
-            } else if(null == user.getUuzcUserSpaceDetail()) {// 个人用户
-                UuzcUserInfo info = getUserInfo(user, false);
+            } else if (null == detail) {// 个人用户
+                UuzcUserInfo info = getUserInfo(user, detail, false);
                 JSONObject formData = JSON.parseObject(JSON.toJSONString(info));
                 map.put("user", formData);
                 map.put("usertype", "personal");
@@ -75,7 +76,7 @@ public class UuzcController extends BaseController {
      * @param company
      * @return
      */
-    private UuzcUserInfo getUserInfo(UserView user, boolean company) {
+    private UuzcUserInfo getUserInfo(UserView user, UuzcUserSpaceDetail detail, boolean company) {
         UuzcUserInfo info = new UuzcUserInfo();
         info.setEmail(user.getSecondUID());
         info.setMobile(user.getUid());
@@ -83,18 +84,18 @@ public class UuzcController extends BaseController {
         info.setPassword(user.getPassword());
         info.setSalt(user.getSalt());
         info.setUsername(user.getName());
-        if(null != user.getUuzcUserSpaceDetail() && company) {
+        if (null != detail && company) {
             info.setCompanyname(user.getSpaceName());
             info.setLicense(user.getSpaceUID());
-            info.setContact(user.getUuzcUserSpaceDetail().getContactMan() != null ?
-                    user.getUuzcUserSpaceDetail().getContactMan() : user.getUuzcUserSpaceDetail().getAdminName());
-            info.setWebsite(user.getUuzcUserSpaceDetail().getUrl());
-            info.setTelephone(user.getUuzcUserSpaceDetail().getTel() != null ?
-                    user.getUuzcUserSpaceDetail().getTel() : user.getUuzcUserSpaceDetail().getAdminTel());
-            info.setLandine_tel(user.getUuzcUserSpaceDetail().getContactTel() != null ?
-                    user.getUuzcUserSpaceDetail().getContactTel() : user.getUuzcUserSpaceDetail().getAdminTel());
+            info.setContact(detail.getContactMan() != null ?
+                    detail.getContactMan() : detail.getAdminName());
+            info.setWebsite(detail.getUrl());
+            info.setTelephone(detail.getTel() != null ?
+                    detail.getTel() : detail.getAdminTel());
+            info.setLandine_tel(detail.getContactTel() != null ?
+                    detail.getContactTel() : detail.getAdminTel());
         }
-        return  info;
+        return info;
     }
 
     /**
@@ -105,7 +106,7 @@ public class UuzcController extends BaseController {
      */
     @RequestMapping(value = "/setHrAccount", method = RequestMethod.POST)
     public ModelMap setHrAccount(UuzcUserInfo user) throws Exception {
-        UuzcUserSpaceDetail detail = SystemSession.getUser().getUuzcUserSpaceDetail();
+        UuzcUserSpaceDetail detail = AccountUtils.getUuzcUserSpaceDetail(SystemSession.getUser().getSpaceUID());
         User userInfo = new User();
         userInfo.setHr((short) 1);
         userInfo.setName(user.getUsername());
@@ -124,8 +125,19 @@ public class UuzcController extends BaseController {
      */
     @RequestMapping(value = "/existusers", method = RequestMethod.GET)
     public ModelMap getExistUsers() throws Exception {
-        List<User> users = AccountUtils.getEmployees(SystemSession.getUser().getUuzcUserSpaceDetail().getBusinessCode());
+        List<User> users = AccountUtils.getEmployees(SystemSession.getUser().getSpaceUID());
         return success(users);
     }
 
+    /**
+     * 获取当前企业的hr账号信息
+     *
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(value = "/hrInfo", method = RequestMethod.GET)
+    public ModelMap getHrInfo() throws Exception {
+        User user = AccountUtils.getHrInfo(SystemSession.getUser().getSpaceUID());
+        return new ModelMap("user", user);
+    }
 }

+ 3 - 7
src/main/resources/conf/account.properties

@@ -1,17 +1,13 @@
 ### sso config
 sso.app=home
-# token secretkey
+token secretkey
 sso.secretkey=0taQcW073Z7G628g5H
 sso.cookie.secure=false
 
-#ŐýĘ˝
-sso.cookie.domain=.ubtob.com
+#prod
+sso.cookie.domain=ubtob.com
 sso.login.url=https://account.ubtob.com/sso/login
 
-#ąžľŘ
-#sso.cookie.domain=:8080/home
-#sso.login.url=http://hejq.ubtob.com:8090/account/sso/login
-
 ### account center config,
 account.us.save.url=http://10.10.100.133:8080/api/userspace
 account.user.save.url=http://10.10.100.133:8080/api/user

+ 4 - 1
src/main/webapp/WEB-INF/views/normal/index.html

@@ -27,6 +27,7 @@ var _hmt = _hmt || [];
   hm.src = "//hm.baidu.com/hm.js?ab3516f4a7187fa5ac0e449c7db9f195";
   var s = document.getElementsByTagName("script")[0]; 
   s.parentNode.insertBefore(hm, s);
+
 })();
 </script>
 </head>
@@ -210,7 +211,9 @@ var _hmt = _hmt || [];
 								</p>
 							</div>
 							<div class="header-btn">
-								<a href="#" class="link-job-get">我要招人</a><a href="#" class="link-job-post">我要求职</a>
+								<a href="#" class="link-job-get">我要招人</a>
+                                <a href="#" class="link-hr-set" style="display: none">设置HR账号</a>
+                                <a href="#" class="link-job-post">我要求职</a>
 							</div>
 						</div>
 					</div>

+ 5 - 17
src/main/webapp/WEB-INF/views/normal/setHrAccount.html

@@ -76,30 +76,18 @@
 			<div class="section-choose" >
 				<form action="">
 					<div class="form-group">
-						<input type="text" id="username" class="form-control" placeholder="姓名" />
-						<ul id="userList">
-<!--							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>
-							<li><b>李亚津</b><span class="phone">13800001111</span><span>liyj@ftchina.com</span></li>-->
+						<input type="text" id="username" class="form-control" placeholder="姓名" autocomplete="off" />
+						<ul id="userList" style="max-height: 200px; overflow-y: auto;">
 						</ul>
 					</div>
 					<div class="form-group">
-						<input type="text" id="usertel" class="form-control" placeholder="电话号码" />
+						<input type="text" id="usertel" class="form-control" placeholder="电话号码" autocomplete="off"/>
 					</div>
 					<div class="form-group">
-						<input type="text" id="useremail" class="form-control" placeholder="邮箱" />
+						<input type="text" id="useremail" class="form-control" placeholder="邮箱" autocomplete="off"/>
 					</div>
 					<div class="form-group">
-						<input type="text" id="useruu" class="form-control" placeholder="UU号" />
+						<input type="text" id="useruu" class="form-control" placeholder="UU号" autocomplete="off"/>
 					</div>
 					<div class="form-group">
 						<a class="btn" id="setHrAccount" type="submit">添加并设置为HR账号</a>

+ 8 - 0
src/main/webapp/resources/css/index.css

@@ -322,6 +322,14 @@ header .carousel-caption .header-btn a:first-child{
 	color: #fff;
 	background: #f85659;
 }
+
+header .carousel-caption .header-btn .link-hr-set {
+    margin-right: 26px;
+    font-size: 16px;
+    color: #fff;
+    background: #f85659;
+}
+
 header .carousel-caption .header-btn a:last-child{
 	font-size: 16px;
 	color: #f85659;

+ 4 - 0
src/main/webapp/resources/css/setHrAccount.css

@@ -153,4 +153,8 @@ section .container{
     left: 50%!important ;
     margin-left: -10%!important ;
     z-index: 999999;
+}
+#toast-container .toast-message {
+    font-size: 16px;
+    color: #fff;
 }

+ 5 - 1
src/main/webapp/resources/css/toastr.css

@@ -4,6 +4,8 @@
 .toast-message {
   -ms-word-wrap: break-word;
   word-wrap: break-word;
+    font-size: 16px;
+    color: #fff;
 }
 
 .toast-message a,
@@ -209,6 +211,8 @@ button.toast-close-button {
 .toast-message {
     -ms-word-wrap: break-word;
     word-wrap: break-word;
-    font-size: .4rem;
+    /*font-size: .4rem;*/
+    font-size: 12px;
+    color:#fff;
 }
 

+ 159 - 49
src/main/webapp/resources/js/common/common.js

@@ -22,7 +22,33 @@ function getAccountInfo() {
                 $('.x-login').find('.title').text(data.content.name);
             }
 			window._hasAccountInfo = true;
-		}
+			var user = data.content;
+			if(null != data.space) {
+                // 管理员
+                if(user.uid == data.space.adminTel) {
+                    // 如果是hr
+                    if(user.hr == 1) {
+                        $('.link-job-get').show();
+                        $('.link-hr-set').hide();
+                    } else {
+                        $('.link-hr-set').show();
+                        $('.link-job-get').hide();
+                    }
+                } else {// 非管理员
+                    $('.link-job-get').show();
+                    $('.link-hr-set').hide();
+                    var location = window.location.pathname;
+                    if(location.indexOf('setHrAccount') > -1) {// 如果是在设置hr页面,非管理员跳转到首页
+                        window.location.href = 'http://www.ubtob.com/#/uuzcJob';
+                    }
+                }
+            }
+		} else {
+		    var location = window.location.pathname;
+		    if(location.indexOf('setHrAccount') > -1) {// 如果是在设置hr页面,没有登录的话跳转到登录页面
+               login(event);
+            }
+        }
 	});
 }
 
@@ -110,6 +136,32 @@ function jobUuzc() {
     });
 }
 
+/**
+ * 存储hrInfo,不用重新加载
+ *
+ * @type {null}
+ */
+var hrInfo = null;
+
+function getHrInfo() {
+    if(hrInfo == null) {
+        $.get('uuzc/hrInfo', function(userInfo) {
+            if(null != userInfo.user) {
+                hrInfo = userInfo.user;
+                // 默认给相关字段赋值
+                $('#hrname').val(hrInfo.name);
+                $('#hremail').val(hrInfo.secondUID);
+                $('#hrtel').val(hrInfo.uid);
+                $('#username').val(hrInfo.name);
+                $('#usertel').val(hrInfo.uid);
+                $('#useruu').val(hrInfo.dialectUID);
+                $('#useremail').val(hrInfo.secondUID);
+                $('#userList').css('display','none');
+            }
+        });
+    }
+}
+
 /**
  * 链接到优软众创人才招聘(招聘入口)
  */
@@ -121,14 +173,15 @@ function jobUuzcGet() {
         if(null != data && 'personal' == data.usertype) {
             toastr.error("您的账号为个人账号,不可进行此操作");
         } else if(null != data && 'company' == data.usertype) {
-            if(!data.hr) {// 企业不存在hr账号
-                if(data.manager) {// 管理员停留设置hr
+            // 先判断是否管理员
+            if(data.manager) {
+                // if(!data.hr) {// 企业不存在hr账号
                     window.location.href = window.location.origin + window.location.pathname + "setHrAccount";
-                } else {
-                    toastr.error('请通知管理员' + data.managerName + '设置HR账号');
-                }
-            } else {// 如果企业存在hr
-                toastr.error('您的账号非HR账号,不可进行此操作');
+                // } else {// 如果企业存在hr
+                //     toastr.error('您的账号非HR账号,不可进行此操作');
+                // }
+            } else {
+                toastr.error('请通知管理员' + data.managerName + '设置HR账号');
             }
         } else if(data.usertype =='hr') {
             loginJobUuzc(user, loginUrl, 'hr');
@@ -203,18 +256,19 @@ function addHrAccount() {
                var result = data.result;
                if(result == 'success') {
                    toastr.success('设置HR账号成功');
-                   setTimeout(window.location.href = 'http://www.ubtob.com/#/uuzcJob', 500);
+                   hrInfo = null; // 清空已查询的数据,重新加载
+                   setTimeout(window.location.href = 'http://www.ubtob.com/#/uuzcJob', 2000);
                }
                if(result == 'exist') {
                    toastr.error('该企业HR账号已存在');
                }
                if(result == 'setFailure') {
-                   toastr.erroror('设置HR账号失败');
+                   toastr.error('设置HR账号失败');
                }
            }
         },
         error: function (error) {
-            toastr.erroror(error);
+            toastr.error(error);
         }
     });
 }
@@ -235,66 +289,75 @@ function setHrAccount() {
         async: false,
         success: function(data) {
             if(data) {
-                console.log(data);
                 var result = data.result;
                 if(result == 'success') {
                     toastr.success('设置HR账号成功');
-                    setTimeout(window.location.href = 'http://www.ubtob.com/#/uuzcJob', 500);
+                    hrInfo = null; // 清空已查询的数据,重新加载
+                    setTimeout(window.location.href = 'http://www.ubtob.com/#/uuzcJob', 2000);
                 }
                 if(result == 'exist') {
                     toastr.error('该企业HR账号已存在');
                 }
                 if(result == 'setFailure') {
-                    toastr.erroror('设置HR账号失败');
+                    toastr.error('设置HR账号失败');
                 }
             }
         },
         error: function (error) {
-            toastr.erroror(error);
+            toastr.error(error);
         }
     });
 }
 
+/**
+ * 获取的用户信息存放,全局调用,不用多次发生请求
+ *
+ * @type {Array}
+ */
+var users = [];
+
 /**
  * 获取当前企业已存在的用户的信息
  */
 function getExistUser() {
-    var users = [];
-    $.ajax('uuzc/existusers', {
-        dataType: 'json',
-        method: 'GET',
-        async: false,
-        success: function(data) {
-            users = data.content;
-            if(users.length == 0) {
-                $('#userList').css('display','none');
-            }
-            var ul = document.getElementById("userList");
-            for(var i = 0; i < users.length; i++) {
-                var li = document.createElement('li');
-                var b = document.createElement('b');
-                b.innerHTML = users[i].name;
-                li.appendChild(b);
-                var span = document.createElement('span');
-                span.class = "phone"
-                span.innerHTML = users[i].uid;
-                li.appendChild(span);
-                var span2 = document.createElement('span');
-                span2.innerHTML = users[i].secondUID;
-                li.appendChild(span2);
-                li.id = 'btn_' + i;
-                ul.appendChild(li);
-                (function(i) {
-                    $("#btn_" + i ).click(function() {
-                        setAccount(users[i]);
-                        $('#userList').css('display','none');
-                    });
-                })(i)
+    if(users.length == 0) {
+        $.ajax('uuzc/existusers', {
+            dataType: 'json',
+            method: 'GET',
+            async: false,
+            success: function(data) {
+                users = data.content;
+                if(users.length == 0) {
+                    $('#userList').css('display','none');
+                }
+                var ul = document.getElementById("userList");
+                for(var i = 0; i < users.length; i++) {
+                    var li = document.createElement('li');
+                    var b = document.createElement('b');
+                    b.innerHTML = users[i].name;
+                    li.appendChild(b);
+                    var span = document.createElement('span');
+                    span.class = "phone"
+                    span.innerHTML = users[i].uid;
+                    li.appendChild(span);
+                    var span2 = document.createElement('span');
+                    span2.innerHTML = users[i].secondUID;
+                    li.appendChild(span2);
+                    li.id = 'btn_' + i;
+                    ul.appendChild(li);
+                    (function(i) {
+                        $("#btn_" + i ).click(function() {
+                            setAccount(users[i]);
+                            $('#userList').css('display','none');
+                        });
+                    })(i)
+                }
             }
-        }
-    });
+        });
+    }
 }
 
+
 /**
  * 选择现有的人员赋值
  *
@@ -313,6 +376,47 @@ function setAccount(user) {
 function suspendMessage() {
     toastr.error('网站正在升级中,敬请期待!');
 }
+
+/**
+ * 监听输入框值的变化设置联想
+ */
+$('#username').bind('input propertychange', function() {
+    var nameList = [];
+    $("#userList").find("li").remove();// 先清除以前的样式
+    for(var i = 0; i < users.length; i++) {
+        if(users[i].name.indexOf($('#username').val()) > -1) {
+            nameList.push(users[i]);
+        }
+    }
+    if(nameList.length == 0) {
+        $('#userList').css('display','none');
+    } else {
+        $('#userList').css('display','show');
+    }
+    var ul = document.getElementById("userList");
+    for(var i = 0; i < nameList.length; i++) {
+        var li = document.createElement('li');
+        var b = document.createElement('b');
+        b.innerHTML = nameList[i].name;
+        li.appendChild(b);
+        var span = document.createElement('span');
+        span.class = "phone"
+        span.innerHTML = nameList[i].uid;
+        li.appendChild(span);
+        var span2 = document.createElement('span');
+        span2.innerHTML = nameList[i].secondUID;
+        li.appendChild(span2);
+        li.id = 'btn_' + i;
+        ul.appendChild(li);
+        (function(i) {
+            $("#btn_" + i ).click(function() {
+                setAccount(nameList[i]);
+                $('#userList').css('display','none');
+            });
+        })(i)
+    }
+});
+
 $(function() {
 	'use strict';
 	
@@ -327,6 +431,9 @@ $(function() {
 	
 	// 查询登录信息
 	getAccountInfo();
+
+	// 获取当前企业HR信息
+    getHrInfo();
 	
 	// 登录点击
 	$('.link-login').click(login);
@@ -340,9 +447,12 @@ $(function() {
     // 连接到众创招聘
     $('.link-job').click(jobUuzc);
 
-    // 求职
+    // 点击链接到众创人才招聘(求职)
     $('.link-job-post').click(jobUuzcPost);
 
+    // 点击链接到众创人才招聘(设置hr)
+    $('.link-hr-set').click(jobUuzcGet);
+
     // 添加hr账号(新增)
     $('#addHrAccount').click(addHrAccount);
 

+ 1 - 1
src/main/webapp/resources/js/common/toastr.js

@@ -177,7 +177,7 @@
                     },
                     iconClass: 'toast-info',
                     positionClass: 'toast-top-right',
-                    timeOut: 500000, // Set timeOut and extendedTimeOut to 0 to make it sticky
+                    timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
                     titleClass: 'toast-title',
                     messageClass: 'toast-message',
                     target: 'body',