fix 账号组织bug

master
yuan 7 years ago
parent c228696136
commit e968c49c2b

@ -40,6 +40,7 @@ public class ManagerInfo {
private boolean orgmanager;
@JSONField(name = "org_id")
private Integer orgId;
private Integer parent_org_id;
public JSONObject accountJson(boolean insert) {
JSONObject account = new JSONObject();
@ -110,6 +111,7 @@ public class ManagerInfo {
account.put("username", getUsername());
}
account.put("org_id", orgId);
account.put("parent_org_id",parent_org_id);
return account;
}
@ -272,4 +274,12 @@ public class ManagerInfo {
public void setOrgmanager(boolean orgmanager) {
this.orgmanager = orgmanager;
}
public Integer getParent_org_id() {
return parent_org_id;
}
public void setParent_org_id(Integer parent_org_id) {
this.parent_org_id = parent_org_id;
}
}

@ -9,7 +9,7 @@ import java.util.List;
* Created by yixian on 2016-07-05.
*/
public interface ManagerAccountsService {
List<JSONObject> listManagers(JSONObject loginManager);
List<JSONObject> listManagers(JSONObject loginManager,JSONObject params);
void saveManager(ManagerInfo manager, JSONObject loginManager);

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.signin.core.impls;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
@ -30,12 +31,15 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Resource
private FinancialBDConfigMapper financialBDConfigMapper;
@Resource
private OrgManager orgManager;
@Override
public List<JSONObject> listManagers(JSONObject loginManager) {
JSONObject params = new JSONObject();
if (loginManager.getInteger("org_id") != null) {
public List<JSONObject> listManagers(JSONObject loginManager,JSONObject params) {
/* if (loginManager.getInteger("org_id") != null) {
params.put("org_id", loginManager.getIntValue("org_id"));
}
}*/
orgManager.checkOrgIds(loginManager,params);
List<JSONObject> managers = managerMapper.listAvailable(params, new PageBounds(Order.formString("create_time.desc")));
for (JSONObject manager : managers) {
int role = manager.getIntValue("role");
@ -90,7 +94,7 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
if (manager.isAdmin() || manager.isFinacial() || manager.isOperator() || manager.isServant() || manager.isSitemanager() || manager.isDeveloper()) {
throw new BadRequestException("Invalid Role");
}
obj.remove("org_id");
//obj.remove("org_id");
}
obj.put("manager_id", userId);
managerMapper.update(obj);

@ -10,6 +10,7 @@ import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.http.HttpUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
@ -37,9 +38,15 @@ public class ManagerAccountsController {
@RequestMapping(method = RequestMethod.GET)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER})
public List<JSONObject> listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestParam Map<String, Object> map) {
loginManager.putAll(map);
return managerAccountsService.listManagers(loginManager);
public List<JSONObject> listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestParam(required = false) String org_id,@RequestParam(required = false) String org_id2) {
JSONObject params = new JSONObject();
if(org_id != null){
params.put("org_id",org_id);
}
if (StringUtils.isNotEmpty(org_id2)) {
params.put("org_id2", org_id2);
}
return managerAccountsService.listManagers(loginManager,params);
}
@RequestMapping(method = RequestMethod.POST)

@ -15,7 +15,8 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.search = {role:'111111111111'};
$scope.params = {};
$scope.listManagers = function () {
$http.get('/sys/manager_accounts').then(function (resp) {
var params = angular.copy($scope.params);
$http.get('/sys/manager_accounts',{params: params}).then(function (resp) {
$scope.managers = resp.data;
})
};
@ -35,8 +36,6 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
})
};
$scope.listManagers();
$scope.modifyManager = function (manager) {
$uibModal.open({
@ -83,7 +82,6 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.loadOrgs();
$scope.loadOrgsChild= function (org_id) {
$scope.is_org2 = 'not_is';
$scope.choose_org = org_id;
var params = angular.copy($scope.params);
params.org_id = org_id;
@ -91,15 +89,19 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.orgs_child = resp.data;
})
};
if(!$scope.manager.parent_org_id){
$scope.is_org2 = 'not_is'
}else {
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id){
var params = angular.copy($scope.params);
params.org_id = $scope.currentUser.org_id;
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
$scope.orgs_child = resp.data;
})
$scope.manager.org_id2 = $scope.manager.org_id;
}
if($scope.manager.parent_org_id){
$scope.manager.org_id2 = $scope.manager.org_id;
$scope.manager.org_id = $scope.manager.parent_org_id;
$scope.loadOrgsChild($scope.manager.org_id);
$scope.is_org2 = 'is';
};
}
$scope.modify = function () {
$scope.errmsg = null;
if($scope.manager.password && $scope.manager.password.length < 8){
@ -121,20 +123,16 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
})
};
$scope.changeIsOrg2 = function (choose_org2) {
if($scope.choose_org != choose_org2){
$scope.is_org2 = 'is';
}else {
$scope.is_org2 = 'not_is'
}
}
}]);
app.controller('newManagerDialogCtrl', ['$scope', '$http', function ($scope, $http) {
$scope.params = {};
$scope.is_org2 = 'not_is';
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id){
var params = angular.copy($scope.params);
params.org_id = $scope.currentUser.org_id;
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
$scope.orgs_child = resp.data;
})
}
$scope.save = function (form) {
$scope.errmsg = null;
if (form.$invalid) {
@ -154,6 +152,9 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
// $scope.errmsg = 'The password needs to consist of 8-16 digits and letters !';
// return;
// }
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id){
$scope.manager.bd = true;
}
if($scope.manager.org_id2 != "null") {
$scope.manager.org_id = $scope.manager.org_id2;
}
@ -172,7 +173,6 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.loadOrgs();
$scope.loadOrgsChild= function (org_id) {
$scope.is_org2 = 'not_is';
$scope.choose_org = org_id;
var params = angular.copy($scope.params);
params.org_id = org_id;
@ -180,14 +180,6 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.orgs_child = resp.data;
})
};
$scope.changeIsOrg2 = function (choose_org2) {
if($scope.choose_org != choose_org2){
$scope.is_org2 = 'is';
}else {
$scope.is_org2 = 'not_is'
}
}
}]);
app.filter('managersFilter', [function () {
return function (arr, filterObj) {

@ -17,7 +17,7 @@
<label class="control-label" for="username-filter-input">Username</label>
<input type="text" class="form-control" ng-model="search.username" placeholder="Username" id="username-filter-input">
</div>
<div class="form-group" ng-if="'1'|withRole">
<div class="form-group" ng-if="('1'|withRole)">
<label class="control-label" for="role-filter-select">Role</label>
<select class="form-control" id="role-filter-select" ng-model="search.role">
<option value="111111111111">All</option>
@ -36,17 +36,18 @@
<option value="1000000000000">Org Manager</option>
</select>
</div>
<div class="form-group" ng-if="'1'|withRole">
<select id="org-select" class="form-control" ng-model="search.org_id"
<div class="form-group" ng-if="('1'|withRole)">
<select id="org-select" class="form-control" ng-model="params.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs"
ng-change="loadOrgsChild(search.org_id)">
ng-change="params.org_id2 = '';listManagers();loadOrgsChild(params.org_id)">
<option value="">All Organizations</option>
</select>
</div>
<div ng-if="((orgs_child.length > 1)&&( '1'|withRole))">
<select id="org-child-select" class="form-control" ng-model="search.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child">
<div ng-if="(orgs_child.length > 1)&&('1'|withRole)">
<select id="org-child-select" class="form-control" ng-model="params.org_id2"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child"
ng-change="listManagers()">
<option value="">Sub Organizations</option>
</select>
</div>

@ -45,7 +45,7 @@
<input class="form-control" type="text" id="wechat-input" name="wechat"
ng-model="manager.wechat">
</div>
<div class="form-group" ng-if="is_org2=='not_is'">
<div class="form-group">
<label class="control-label">Roles</label>
<p class="checkbox-inline checkbox">
<label ng-if="('00001'|withRole)">
@ -86,14 +86,6 @@
</label>
</p>
</div>
<div class="form-group" ng-if="!currentUser.org_id && is_org2=='is'">
<label class="control-label">Roles</label>
<p class="checkbox checkbox-inline">
<label ng-if="!manager.admin && !manager.operator">
<input type="checkbox" ng-model="manager.bd" name="bd">BD User
</label>
</p>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && !manager.sitemanager && orgs!=null">
<label class="control-label" for="org-select">Organization</label>
<select class="form-control" ng-model="manager.org_id" id="org-select"
@ -103,11 +95,10 @@
</select>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs_child.length > 1">
<div class="form-group" ng-if="(('1'|withRole)||('1000000000000'|withRole)) && !manager.admin && !manager.operator && orgs_child.length > 1">
<label class="control-label" for="org-select">Sub Organization</label>
<select class="form-control" ng-model="manager.org_id2" id="org-child-select"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child"
ng-change="changeIsOrg2(manager.org_id2)">
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child">
<option value="">Choose</option>
</select>
</div>

@ -51,7 +51,7 @@
<input class="form-control" type="text" id="wechat-input" name="wechat"
ng-model="manager.wechat">
</div>
<div class="form-group" ng-if="!currentUser.org_id && is_org2=='not_is'">
<div class="form-group" ng-if="!currentUser.org_id&&!isOrg">
<label class="control-label">Roles</label>
<p class="checkbox checkbox-inline">
<label ng-if="('00001'|withRole)">
@ -95,13 +95,15 @@
</label>
</p>
</div>
<div class="form-group" ng-if="!currentUser.org_id && is_org2=='is'">
<div class="form-group" ng-if="!currentUser.org_id &&isOrg">
<label class="control-label">Roles</label>
<p class="checkbox checkbox-inline">
<label ng-if="!manager.admin && !manager.operator">
<input type="checkbox" ng-model="manager.bd" name="bd">BD User
</label>
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="guest">Org Manager
</label>
</p>
</div>
@ -114,11 +116,10 @@
</select>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs_child.length > 1">
<div class="form-group" ng-if="(('1'|withRole)||('1000000000000'|withRole)) && !manager.admin && !manager.operator && orgs_child.length > 1">
<label class="control-label" for="org-select">Sub Organization</label>
<select class="form-control" ng-model="manager.org_id2" id="org-child-select"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child"
ng-change="changeIsOrg2(manager.org_id2)">
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child">
<option value="">Choose</option>
</select>
</div>

@ -336,7 +336,40 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
app.controller('modifyManagerCtrl', ['$scope', '$http', 'manager', function ($scope, $http, manager) {
$scope.manager = manager;
$scope.params = {};
$scope.loadOrgs = function () {
$http.get('/sys/orgs').then(function (resp) {
$scope.orgs = resp.data;
})
};
$scope.loadOrgs();
$scope.loadOrgsChild= function (org_id) {
$scope.choose_org = org_id;
var params = angular.copy($scope.params);
params.org_id = org_id;
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
$scope.orgs_child = resp.data;
})
};
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id){
$scope.loadOrgsChild($scope.currentUser.org_id);
}
if($scope.manager.parent_org_id){
$scope.manager.org_id2 = $scope.manager.org_id;
$scope.manager.org_id = $scope.manager.parent_org_id;
$scope.loadOrgsChild($scope.manager.org_id);
};
$scope.modify = function () {
/*if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id){
if($scope.manager.org_id2 != "null") {
$scope.manager.parent_org_id = $scope.manager.org_id2;
}
delete $scope.manager.org_id2;
}*/
if($scope.manager.org_id2 != null && $scope.manager.org_id2 != 'null') {
$scope.manager.org_id = $scope.manager.org_id2;
}
$scope.errmsg = null;
$http.put('/sys/manager_accounts/' + manager.manager_id, $scope.manager).then(function () {
$scope.$close();
@ -352,7 +385,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
$scope.loadOrgs();
}]);
app.controller('newManagerCtrl', ['$scope', '$http','org',function ($scope, $http,org) {
$scope.isOrg = true;
$scope.save = function (form) {
$scope.manager.org_id = org.org_id;
$scope.errmsg = null;
@ -364,9 +397,13 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
});
return;
}
if(currentUser.org_id != null && !currentUser.parent_org_id){
$scope.manager.bd=true;
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && $scope.currentUser.org_id){
$scope.manager.bd = true;
}
if($scope.manager.org_id2 != "null") {
$scope.manager.org_id = $scope.manager.org_id2;
}
delete $scope.manager.org_id2;
$http.post('/sys/manager_accounts', $scope.manager).then(function () {
$scope.$close();

Loading…
Cancel
Save