Browse Source

Merge remote-tracking branch 'origin/feature-wangcz-201814' into feature-wangcz-201814

liusw 7 years ago
parent
commit
ee9b22489f

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

@@ -132,7 +132,9 @@ public class AuthenticationController {
 		String currUrl;
 		try {
 			currUrl = URLDecoder.decode(resUrl, "UTF-8");
-			currUrl = "/" + currUrl;
+			if (!currUrl.substring(0,1).equals("/")) {
+				currUrl = "/" + currUrl;
+			}
 		} catch (UnsupportedEncodingException e) {
 			throw new IllegalArgumentException("URL编码错误!");
 		}

+ 13 - 5
src/main/java/com/uas/platform/b2c/common/account/model/User.java

@@ -501,12 +501,20 @@ public class User implements Serializable {
 	 */
 	public void setCurrentEnterpriseRoles() {
 		if(!CollectionUtils.isEmpty(this.roles) && this.enterprise != null) {
-			Iterator<Role> iterator = this.roles.iterator();
+//			Iterator<Role> iterator = this.roles.iterator();
+//			Long enuu = this.enterprise.getUu();
+//			while (iterator.hasNext()) {
+//				Role role = iterator.next();
+//				if(!role.getEnUU().equals(enuu)) {
+//					iterator.remove();
+//				}
+//			}
+			Set<Role> roles = this.roles;
+			this.roles = new HashSet<>();
 			Long enuu = this.enterprise.getUu();
-			while (iterator.hasNext()) {
-				Role role = iterator.next();
-				if(!role.getEnUU().equals(enuu)) {
-					iterator.remove();
+			for (Role role : roles) {
+				if (role.getEnUU().equals(enuu)) {
+					this.roles.add(role);
 				}
 			}
 		}

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/account/service/impl/UserServiceImpl.java

@@ -558,7 +558,7 @@ public class UserServiceImpl implements UserService {
 		}
 		ModelMap map = new ModelMap();
 		map.put("status","fail");
-		map.put("msg","没有该权限,请联系管理员");
+		map.put("msg","没有该权限,请联系管理员");
 		return map;
 	}
 }

+ 15 - 9
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js

@@ -4,7 +4,7 @@
  */
 define(['app/app'], function (app) {
     "use strict";
-    app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal', 'BaseService', 'ngTableParams', '$http', 'AuthenticationService', '$stateParams','AccountResource','AccountRole', function ($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http, AuthenticationService, $stateParams, AccountResource, AccountRole) {
+    app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal', 'BaseService', 'ngTableParams', '$http', 'AuthenticationService', '$stateParams','AccountResource','AccountRole', 'Authority', function ($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http, AuthenticationService, $stateParams, AccountResource, AccountRole, Authority) {
         $rootScope.active = 'vendor_account_management';
         document.title = '账户管理-优软商城';
         $scope.tab = 'base';
@@ -406,14 +406,20 @@ define(['app/app'], function (app) {
          * 变更到更新状态
          */
         $scope.changeToUpdate = function (isUpdate) {
-            if ($rootScope.userInfo.userUU != $rootScope.userInfo.enterprise.enAdminuu) {
-                toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
-                return;
-            }
-            $scope.updateState = isUpdate;
-            if ($scope.updateState == false) {
-                $scope.enterpriseInfo = angular.copy($scope.enterpriseInfoBackup);
-            }
+            // if ($rootScope.userInfo.userUU != $rootScope.userInfo.enterprise.enAdminuu) {
+            //     toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
+            //     return;
+            // }
+            Authority.getAuthority({resUrl: '/basic/enterprise/*/updateInfo'}, function (data) {
+                if (data.status == 'fail') {
+                    toaster.pop('error', data.msg || '系统错误');
+                } else {
+                    $scope.updateState = isUpdate;
+                    if ($scope.updateState == false) {
+                        $scope.enterpriseInfo = angular.copy($scope.enterpriseInfoBackup);
+                    }
+                }
+            });
         };
 
           /**

+ 37 - 25
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_store_maintain_ctrl.js

@@ -1,6 +1,6 @@
 define(['app/app'], function (app) {
 	"use strict";
-	app.register.controller('vendorStoreMaintainCtrl', ['$scope', '$rootScope', 'Enterprise', 'StoreInfo', '$modal', 'toaster', '$timeout', '$state', 'RecommendProductService', function($scope, $rootScope, Enterprise, StoreInfo, $modal, toaster, $timeout, $state, RecommendProductService) {
+	app.register.controller('vendorStoreMaintainCtrl', ['$scope', '$rootScope', 'Enterprise', 'StoreInfo', '$modal', 'toaster', '$timeout', '$state', 'RecommendProductService', 'Authority', function($scope, $rootScope, Enterprise, StoreInfo, $modal, toaster, $timeout, $state, RecommendProductService, Authority) {
 		$rootScope.active = "vendor_store";
 		document.title = '我的店铺-优软商城';
 		// 编辑状态
@@ -141,11 +141,17 @@ define(['app/app'], function (app) {
 		 * @param module	模块名称
 		 */
 		$scope.showEdit = function (module) {
-			if ($rootScope.userInfo.userUU != $rootScope.userInfo.enterprise.enAdminuu) {
-				toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
-				return;
-			}
-			changeEditStatus(module, true);
+			// if ($rootScope.userInfo.userUU != $rootScope.userInfo.enterprise.enAdminuu) {
+			// 	toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
+			// 	return;
+			// }
+			Authority.getAuthority({resUrl: '/store-service/stores/*'}, function (data) {
+				if (data.status == 'fail') {
+					toaster.pop('error', data.msg || '系统错误');
+				} else {
+					changeEditStatus(module, true);
+				}
+			});
 		};
 
 		/**
@@ -545,26 +551,32 @@ define(['app/app'], function (app) {
 		$scope.cancleProductEdit = cancleProductEdit;
 
 		function editRecommendProduct(module, status) {
-			if ($rootScope.userInfo.userUU != $rootScope.userInfo.enterprise.enAdminuu) {
-				toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
-				return;
-			}
-			if (module == 'BATCH_OPERATION') {
-				$scope.canBatchOperation = status;
-				return ;
-			}
-			if (module == 'EDIT_PRODUCTS') {
-				$scope.canEditProduct = status;
-
-				// 扩充products
-				console.log(10 - $scope.recommendProducts.length);
-				for (var i = $scope.recommendProducts.length; i < 10; i++) {
-					$scope.recommendProducts[i] = { exist: false, order: i + 1 };
+			// if ($rootScope.userInfo.userUU != $rootScope.userInfo.enterprise.enAdminuu) {
+			// 	toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
+			// 	return;
+			// }
+			Authority.getAuthority({resUrl: '/store-service/stores/*'}, function (data) {
+				if (data.status == 'fail') {
+					toaster.pop('error', data.msg || '系统错误');
+				} else {
+					if (module == 'BATCH_OPERATION') {
+						$scope.canBatchOperation = status;
+						return ;
+					}
+					if (module == 'EDIT_PRODUCTS') {
+						$scope.canEditProduct = status;
+
+						// 扩充products
+						console.log(10 - $scope.recommendProducts.length);
+						for (var i = $scope.recommendProducts.length; i < 10; i++) {
+							$scope.recommendProducts[i] = { exist: false, order: i + 1 };
+						}
+						console.log($scope.recommendProducts.length);
+						return ;
+					}
+					return false;
 				}
-				console.log($scope.recommendProducts.length);
-				return ;
-			}
-			return false;
+			});
 		}
 
 		function cancleProductEdit(module) {