Bläddra i källkod

买家中心首页加载判断

liusw 8 år sedan
förälder
incheckning
a911ba74e5

+ 12 - 1
src/main/java/com/uas/platform/b2c/common/account/controller/AuthenticationController.java

@@ -2,8 +2,11 @@ package com.uas.platform.b2c.common.account.controller;
 
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.account.model.UserInfo;
+import com.uas.platform.b2c.common.account.model.UserQuestion;
+import com.uas.platform.b2c.common.account.service.UserQuestionService;
 import com.uas.platform.b2c.common.account.service.UserService;
 import com.uas.platform.b2c.core.support.SystemSession;
+import java.util.List;
 import net.sf.ehcache.CacheManager;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -21,6 +24,9 @@ public class AuthenticationController {
 	@Autowired
 	private UserService userService;
 
+	@Autowired
+	private UserQuestionService userQuestionService;
+
 	@RequestMapping(method = RequestMethod.GET, headers = "Accept=application/json")
 	@ResponseBody
 	@ResponseStatus(value = HttpStatus.OK)
@@ -28,7 +34,12 @@ public class AuthenticationController {
 		if (SystemSession.getUser() == null) {
 			return null;
 		}
-		return new UserInfo(SystemSession.getUser());
+		List<UserQuestion> userQuestion = userQuestionService.findUserQuestionByUserUUOrderBySortAsc(SystemSession.getUser().getUserUU());
+		UserInfo userInfo = new UserInfo(SystemSession.getUser());
+		if(userQuestion!=null){
+			userInfo.setHaveUserQuestion(userQuestion.size()>0?true:false);
+		}
+		return userInfo;
 	}
 
 	/**

+ 2 - 1
src/main/java/com/uas/platform/b2c/common/account/controller/UserController.java

@@ -630,7 +630,8 @@ public class UserController {
 	 */
 	@RequestMapping(value = "/updateIdEnable", method = RequestMethod.GET)
 	public ResponseEntity<String> updateIdEnable(final User user) {
-		userService.saveRealAuth(user);
+		User newUser = userService.saveRealAuth(user);
+		SystemSession.setUser(newUser);
 		return new ResponseEntity<String>(HttpStatus.OK);
 	}
 }

+ 77 - 0
src/main/java/com/uas/platform/b2c/common/account/model/UserInfo.java

@@ -24,6 +24,7 @@ public class UserInfo {
 		this.userName = user.getUserName();
 		this.userTel = user.getUserTel();
 		this.userSex = user.getUserSex();
+		this.pwdEnable = user.getPwdSecLevel()>1?true:false;
 		this.sys = user.isSys();
 		if (user.getRoles() != null && user.getRoles().size() > 0) {
 			StringBuffer sb = new StringBuffer();
@@ -50,6 +51,32 @@ public class UserInfo {
 			}
 			this.enterprises = list;
 		}
+		this.havePayPwd = user.getUserPay()==null?false:true;
+		this.idEnable = user.getIdEnable();
+		this.secLevel = countSecLevel();
+	}
+
+	private Short countSecLevel(){
+		Short count = 0;
+		if(getIdEnable()!=null && getIdEnable()==1){
+			count++;
+		}
+		if(isPwdEnable()){
+			count++;
+		}
+		if(isHavePayPwd()){
+			count++;
+		}
+		if(getUserEmail()!=null){
+			count++;
+		}
+		if(getUserTel()!=null){
+			count++;
+		}
+		if(isHavePayPwd()){
+			count++;
+		}
+		return count;
 	}
 
 	public static Page<UserInfo> getUserInfo(Page<User> page) {
@@ -76,8 +103,58 @@ public class UserInfo {
 	
 	private boolean sys;
 
+	private boolean pwdEnable;
+
+	private Short idEnable;
+
 	private List<Map<String, Object>> enterprises;
 
+	private boolean havePayPwd;
+
+	private boolean haveUserQuestion;
+
+	private Short secLevel;
+
+	public Short getSecLevel() {
+		return secLevel;
+	}
+
+	public void setSecLevel(Short secLevel) {
+		this.secLevel = secLevel;
+	}
+
+	public boolean isHaveUserQuestion() {
+		return haveUserQuestion;
+	}
+
+	public void setHaveUserQuestion(boolean haveUserQuestion) {
+		this.haveUserQuestion = haveUserQuestion;
+	}
+
+	public boolean isHavePayPwd() {
+		return havePayPwd;
+	}
+
+	public void setHavePayPwd(boolean havePayPwd) {
+		this.havePayPwd = havePayPwd;
+	}
+
+	public Short getIdEnable() {
+		return idEnable;
+	}
+
+	public void setIdEnable(Short idEnable) {
+		this.idEnable = idEnable;
+	}
+
+	public boolean isPwdEnable() {
+		return pwdEnable;
+	}
+
+	public void setPwdEnable(boolean pwdEnable) {
+		this.pwdEnable = pwdEnable;
+	}
+
 	public Long getUserUU() {
 		return userUU;
 	}

+ 1 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js

@@ -24,6 +24,7 @@ define(['app/app'], function(app) {
 			});
 		};
 
+		//
 
 		/**
 		 * 设置默认收货地址

+ 8 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_home_ctrl.js

@@ -14,6 +14,14 @@ define(['app/app', 'calendar'], function(app) {
         };
         getRecommendComps(null, null, {page: 0, size: 12});
 
+        //安全级别
+        $scope.secSuccess = false;
+        if($scope.userInfo.pwdEnable && ($scope.userInfo.haveUserQuestion || $scope.userInfo.userEmail==null?false:true)){//通过验证
+          $scope.secSuccess = true;
+        }else{
+            //location.href="#/accountManager";
+        }
+
         /**
          * 获取推荐新店信息
          */

+ 3 - 1
src/main/webapp/resources/view/usercenter/forstore/account_manager.html

@@ -119,7 +119,9 @@
 		<ul>
 			<li>
 				<span>安全等级
-					<span><b>中</b><em><i style="width: 20%;"></i></em></span>
+					<span><b>
+						{{userInfo.secLevel}}
+					</b><em><i style="width: 20%;"></i></em></span>
 					<img src="static/img/user/images/safe.png"/> <!--完成<a href="javascript:void(0)"> 密保设置</a>,提升账户安全。-->
 				</span>
 			</li>

+ 3 - 3
src/main/webapp/resources/view/usercenter/left_nav.html

@@ -24,8 +24,8 @@
             <a href="user#/home"><p ng-class="{'active' : active == 'home'}"><span>买家中心</span></p></a>
             <ul>
                 <li ng-class="{'active' : active == 'buyer_cart'}"><a href="javascript:void(0)" ui-sref="buyer_cart">购物车<em>(<span ng-bind="countCart || 0 | number"></span>)</em></a> </li>
-                <li ng-class="{'active' : active == 'buyer_order'}"><a href="javascript:void(0)" ui-sref="buyer_order">订单中心</a></li>
-                <li ng-class="{'active' : active == 'pay_center'}"><a href="javascript:void(0)" ui-sref="pay_center">支付中心</a></li>
+                <li ng-disabled="true" ng-class="{'active' : active == 'buyer_order'}"><a href="javascript:void(0)" ui-sref="buyer_order">订单中心</a></li>
+                <li ng-disabled="!secSuccess" ng-class="{'active' : active == 'pay_center'}"><a href="javascript:void(0)" ui-sref="pay_center">支付中心</a></li>
                 <!--<li ng-class="{'active' : active == 'my_wallet'}" class="undo">-->
                    <!--<a href="javascript:void(0)" ui-sref="my_wallet">我的钱包</a>-->
                 <!--</li>-->
@@ -33,7 +33,7 @@
                     <!--<a href="javascript:void(0)" ui-sref="my_seek_purchase">我的求购</a>-->
                 <!--</li>-->
                 <!--<li ng-class="{'active' : active == 'buyer_logistics'}"><a href="javascript:void(0)" ui-sref="buyer_logistics">物流信息</a></li>-->
-                <li ng-class="{'active' : active == 'buyer_invoice'}"><a href="javascript:void(0)" ui-sref="buyer_invoice">发票管理</a></li>
+                <li ng-class="{'active' : active == 'buyer_invoice'}"><a href="javascript:void(0)" ng-disabled="!secSuccess"  ui-sref="buyer_invoice">发票管理</a></li>
                 <!--<li ng-class="{'active' : active == 'after_sale'}" class="undo">-->
                     <!--<a href="javascript:void(0)" ui-sref="after_sale">申请售后</a>-->
                 <!--</li>-->