Просмотр исходного кода

fix:客户权限转移bug处理

dongbw 7 лет назад
Родитель
Сommit
f5f4e943f6

+ 12 - 2
src/main/java/com/uas/platform/b2b/service/impl/UserServiceImpl.java

@@ -920,11 +920,21 @@ public class UserServiceImpl implements UserService {
 		if (null != userUU) {
 			List<Distribute> transfers = distributeDao.findByUserUUAndVendorId(SystemSession.getUser().getUserUU(), vendors.get(0).getId());
 			if (!CollectionUtils.isEmpty(transfers)) {
+				Long oldUserUU = transfers.get(0).getUserUU();
 				transfers.get(0).setUserUU(userUU);
+
+				// 如果被转移方已有当前客户的分配,先删除(可能是非转移的权限,比被管理员转移的权限低级)
+                List<Distribute> oldDistributes = distributeDao.findByUserUUAndVendorId(userUU, vendors.get(0).getId());
+                if (!CollectionUtils.isEmpty(oldDistributes)) {
+                    distributeDao.delete(oldDistributes);
+                }
+
 				distributeDao.save(transfers.get(0));
-				List<Distribute> distributes = distributeDao.findByUserUUAndVendorId(userUU, vendors.get(0).getId());
+
+				// 删除其他可能存在的转移方与当前客户权限关系
+				List<Distribute> distributes = distributeDao.findByUserUUAndVendorId(oldUserUU, vendors.get(0).getId());
 				if (!CollectionUtils.isEmpty(distributes)) {
-					distributeDao.delete(distributes.get(0));
+					distributeDao.delete(distributes);
 				}
 				return true;
 			}

+ 8 - 8
src/main/resources/dev/account.properties

@@ -1,8 +1,7 @@
-### account center config, 
-account.us.save.url=http://10.10.100.133/api/userspace
-account.user.save.url=http://10.10.100.133/api/user
-account.user.getPartners.url = http://10.10.100.133/api/partners
-account.user.getContactPage.url = http://113.105.74.135:8001/business/groups
+account.us.save.url=http://192.168.253.6:32323/api/userspace
+account.user.save.url=http://192.168.253.6:32323/api/user
+account.user.getPartners.url = http://192.168.253.6:32323/api/partners
+account.user.getContactPage.url=http://192.168.253.6:32323/business/groups
 
 ### sso config
 sso.app=b2b
@@ -10,11 +9,12 @@ sso.app=b2b
 sso.secretkey=0taQcW073Z7G628g5H
 sso.cookie.secure=false
 sso.cookie.browser=false
-sso.login.url=http://113.105.74.135:8001/sso/login
+sso.login.url=http://192.168.253.6:32323/
+sso.logout.url=http://192.168.253.6:32323/logquit
 
 #cross domain
-sso.ask.url=http://113.105.74.135:8001/sso/login/ask
-sso.askout.url=http://113.105.74.135:8001/sso/logout/ask
+sso.ask.url=http://192.168.253.6:32323/sso/login/ask
+sso.askout.url=http://192.168.253.6:32323/sso/logout/ask
 sso.proxy.uri=login/proxy
 sso.authcookie.secretkey=Z318866alN6gA0piuO
 sso.client.private_key=MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAIquTH9rOygR1iyMzU1CSQDXG+lJpMQgWkRWMwO3lzS+UJ3GRq1yxxD8mPFZCuItMRxP4Mvu3nvxDvsJx8lfRXk4MGswROIBPcdBAnasphN7wS5mDvDe/VBIKv+fg4j4VEnak9VUAQhS1gDtp+ZmQpCc9/gz8vueF1ueIXspAoUhAgMBAAECgYBfMP8PY1KK0Zt6nvd5NauYqQ7elg9EFJUBXU3NGmLu8Eez1NrEygk8braoy57921lffrDmKsOKvc+zn2YEoqGzbHCOuYsTDBXFCGLkj8oPeHyrs02+XuJe9j2ejhq2N04oP/TMxerFeyWnHdRCNXECrthqhwTRmGitnj2/+FLVAQJBAM93HY/5HoFlfRv9zjFy72ft/ZC60jHERXwyumbFs8z/x8sHCY1GWfgGhm1ShE1bDWAPY3W9WCFsx6nOETsHajECQQCrH8Dl7IIIHJ5D0TDisFkePnYELxpmOGlPwPOQ7hyLAdW4aB1fVIpjsWmgGOyPvmhK+b99XeLUbwpxVU7AAB3xAkAJNxJCFd+sAbUH7EMfYSqPJDwSFKpHeZ9Yf+xVqkxtO6NFOl/LPae7Y5bO/k5QHU4/yQ8y6KEkgu9vdG7Bf3fRAkEAiDlX6vDytphpmN0PyHXQC9Z3Rm9k2ZjwpM+aVXZn/HSyeQFQ2JHJNQGHby5IK0nNZloYiSlTJ/9ZVc0uSoQNUQJBAJFix2tD7b0Zq82xpeGt81rhXsofuerq1x9WM5UyYILCKJMHZw5lt58snINVzA7JxV+l60dbIgJjmRYm0yxQIAY=

+ 20 - 21
src/main/webapp/resources/js/index/app.js

@@ -2136,10 +2136,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         // 分配用户
         $scope.addUserInfo = function (customer) {
-            if (!$scope.enabled) {
-                toaster.pop('error', '您没有为当前客户分配用户的权限!');
-                return;
-            }
+            // if (!$scope.enabled) {
+            //     toaster.pop('error', '您没有为当前客户分配用户的权限!');
+            //     return;
+            // }
             // 获取当前用户在当前企业是否被转移权限
             AccountUser.getEnTransfer ({custUU: customer.myEnterprise.uu}, function(data) {
                 customer.enTransfer = data.result;
@@ -2162,8 +2162,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                             else
                                 loadUsers();
                         }
+                        $scope.customerParams.reload();
                     });
-
                 } else {
                     toaster.pop('error', '您没有为当前客户分配用户的权限!');
                 }
@@ -2173,10 +2173,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         // 转移权限
         $scope.transferUserInfo = function (customer) {
             customer.enDistribute = null;
-            if (!$scope.enabled) {
-                toaster.pop('error', '您没有转移当前客户权限的权限!');
-                return;
-            }
+            // if (!$scope.enabled) {
+            //     toaster.pop('error', '您没有转移当前客户权限的权限!');
+            //     return;
+            // }
             // 获取当前用户在当前企业是否被转移权限
             AccountUser.getDistribute ({custUU: customer.myEnterprise.uu}, function(data) {
                 customer.enDistribute = data.result;
@@ -2199,8 +2199,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                             else
                                 loadUsers();
                         }
+                        $scope.customerParams.reload();
                     });
-
                 } else {
                     toaster.pop('error', '您没有转移当前客户权限的权限!');
                 }
@@ -2462,7 +2462,12 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         }
     }]);
 
-    app.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', function ($scope, $modalInstance, customer, AccountUser, toaster) {
+    app.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService',
+        function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService) {
+        AuthenticationService.getAuthentication().success(function (data) {
+            $scope.thisUser = data;
+        });
+
         $scope.checkboxes = {
             checked: false
         };
@@ -2586,14 +2591,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         var checkStatus = function (userinfos) {
             var transfer = [];
             angular.forEach(userinfos, function (user, index) {
-                if ($scope.thisUser.sys || $scope.thisUser.transfer) {
-                    if (user.transfer) {
-                        transfer.push({num: index});
-                    }
-                } else {
-                    if (user.distribute) {
-                        transfer.push({num: index});
-                    }
+                if (user.transfer) {
+                    transfer.push({num: index});
                 }
             });
             $scope.transfer = transfer;
@@ -2628,9 +2627,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 user.$checked = !user.$checked;
                 angular.forEach($scope.userinfos, function (userInfo) {
                     if (user.userUU !== userInfo.userUU) {
-                        userInfo.distribute = false;
+                        userInfo.transfer = false;
                     } else {
-                        userInfo.distribute = true;
+                        userInfo.transfer = true;
                     }
                 });
             }

+ 1 - 1
src/main/webapp/resources/tpl/index/account/add_userInfo.html

@@ -36,7 +36,7 @@
 		</thead>
 		<tbody>
 				<div style="overflow-y:scroll; width:100%;max-height:500px">			
-					<tr ng-repeat="user in userinfos| filter: keyword">
+					<tr ng-repeat="user in userinfos| filter: keyword" ng-if = "thisUser.userUU != user.userUU">
 						<td width="80px;">{{user.userUU}}</td>
 						<td width="100px;">{{user.userName}}</td>
 						<td width="40px;" style="text-align: center"><input ng-model="user.distribute" name="checkbox" ng-click="checkOne()" type="checkbox"></td>

+ 4 - 4
src/main/webapp/resources/tpl/index/account/transfer_userInfo.html

@@ -36,7 +36,7 @@
 		</thead>
 		<tbody ng-if="thisUser.sys">
 			<!-- 当前用户是管理员时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword" style="overflow-y:scroll; width:100%;max-height:500px" ng-if="!user.sys">
+			<tr ng-repeat="user in userinfos| filter: keyword" ng-if="thisUser.userUU != user.userUU" style="overflow-y:scroll; width:100%;max-height:500px" ng-if="!user.sys">
 				<td width="80px;">{{user.userUU}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center"><input ng-model="user.transfer" name="checkbox" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择"></td>
@@ -44,7 +44,7 @@
 		</tbody>
 		<tbody ng-if="!thisUser.sys && thisUser.transfer">
 			<!-- 当前用户是被管理员转移权限时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword" ng-if="!user.sys">
+			<tr ng-repeat="user in userinfos| filter: keyword" ng-if="!user.sys && thisUser.userUU != user.userUU">
 				<td width="80px;">{{user.userUU}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center"><input ng-model="user.transfer" name="checkbox" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择"></td>
@@ -52,10 +52,10 @@
 		</tbody>
 		<tbody ng-if="!thisUser.sys && !thisUser.transfer">
 			<!-- 当前用户是非管理员,但有查看权限时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword" ng-if="!user.distribute && !user.sys">
+			<tr ng-repeat="user in userinfos| filter: keyword" ng-if="!user.distribute && !user.sys && thisUser.userUU != user.userUU">
 				<td width="80px;">{{user.userUU}}</td>
 				<td width="100px;">{{user.userName}}</td>
-				<td width="40px;" style="text-align: center"><input ng-model="user.distribute" name="distribute" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择"></td>
+				<td width="40px;" style="text-align: center"><input ng-model="user.transfer" name="distribute" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择"></td>
 			</tr>
 		</tbody>
 	</table>