master
yuan 7 years ago
parent 49609d0f2c
commit c964f93649

@ -138,4 +138,5 @@ ALTER TABLE sys_clients_customers ADD COLUMN channel varchar(15) not NULL ;
ALTER TABLE sys_clients_customers ADD COLUMN last_payment_time datetime DEFAULT NULL COMMENT '最后一次付款时间';
ALTER TABLE sys_org ADD COLUMN parent_org_id int(11) DEFAULT NULL;

@ -68,7 +68,6 @@ public class OrgManagerImpl implements OrgManager {
public JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager) {
/* PageBounds sort = new PageBounds(Order.formString("sort_no.asc"));
return orgMapper.listsOrgWithDetail(sort);*/
checkBdRole(manager);
JSONObject params = orgInfo.toJsonParam();
PageList<JSONObject> listOrg = orgMapper.listOrgWithPages(params,new PageBounds(orgInfo.getPage(),orgInfo.getLimit(),Order.formString("sort_no.asc")));
return PageListUtils.buildPageListResult(listOrg);
@ -76,7 +75,6 @@ public class OrgManagerImpl implements OrgManager {
@Override
public JSONObject getOrgDetail(int orgId,JSONObject manager) {
checkBdRole(manager);
return orgMapper.findOne(orgId);
}
@ -124,17 +122,6 @@ public class OrgManagerImpl implements OrgManager {
return listAllOrgs;
}
private void checkBdRole(JSONObject manager){
if(ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))){
if(manager.getString("org_id") != null){
JSONObject org = orgMapper.findOne(manager.getIntValue("org_id"));
if(org != null && org.getIntValue("type") == 0 && org.getString("parent_org_id") != null){
throw new BadRequestException("Invalid Role");
}
}
}
}
@Override
public JSONObject checkOrg(JSONObject manager, JSONObject params){
if (params.getString("org_id")==null){

@ -49,13 +49,13 @@ public class OrgManageController {
return orgManager.listAllOrg();
}
@ManagerMapping(method = RequestMethod.POST, role = {ManagerRole.ADMIN,ManagerRole.BD_USER})
@ManagerMapping(method = RequestMethod.POST, role = {ManagerRole.ADMIN})
public JSONObject saveOrg(@RequestBody @Valid OrgInfo org, Errors errors) {
HttpUtils.handleValidErrors(errors);
return orgManager.saveNewOrg(org);
}
@ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN,ManagerRole.BD_USER})
@ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN})
public JSONObject getOrgDetail(@PathVariable int orgId,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.getOrgDetail(orgId,manager);
}
@ -66,7 +66,7 @@ public class OrgManageController {
orgManager.updateOrg(orgId, org);
}
@ManagerMapping(value = "/{orgId}/enable_change_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN,ManagerRole.BD_USER})
@ManagerMapping(value = "/{orgId}/enable_change_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN})
public void switchEnableChangeRate(@PathVariable int orgId, @RequestBody JSONObject enable){
boolean enabled = enable.getBooleanValue("enabled");
orgManager.switchPermission(orgId,"rate_editable",enabled);

@ -31,7 +31,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override
public List<JSONObject> listManagers(JSONObject loginManager) {
checkBdRole(loginManager);
JSONObject params = new JSONObject();
if (loginManager.getInteger("org_id") != null) {
params.put("org_id", loginManager.getIntValue("org_id"));
@ -58,7 +57,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override
public void saveManager(ManagerInfo manager, JSONObject loginManager) {
checkBdRole(loginManager);
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))) {
if (manager.isAdmin() || manager.isFinacial() || manager.isOperator() || manager.isServant() || manager.isSitemanager() || manager.isDeveloper()) {
throw new BadRequestException("Invalid Role");
@ -74,7 +72,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override
public void modify(String userId, ManagerInfo manager, JSONObject loginManager) {
checkBdRole(loginManager);
JSONObject managerFromDb = managerMapper.findById(userId);
if (managerFromDb == null) {
throw new NotFoundException("manager not exists or invalid");
@ -95,7 +92,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override
public void disable(String userId, JSONObject loginManager) {
checkBdRole(loginManager);
JSONObject manager = managerMapper.findById(userId);
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))){
if (manager.getIntValue("org_id") != loginManager.getIntValue("org_id")) {
@ -127,15 +123,4 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
return financialBDConfigMapper.getBdConfig(bd_id);
}
private void checkBdRole(JSONObject loginManager){
if(ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))){
JSONObject manager = managerMapper.findById(loginManager.getString("manager_id"));
if(manager.getString("org_id") != null){
JSONObject org = orgMapper.findOne(manager.getIntValue("org_id"));
if(org != null && org.getIntValue("type") == 0 && org.getString("parent_org_id") != null){
throw new BadRequestException("Invalid Role");
}
}
}
}
}

@ -36,14 +36,14 @@ public class ManagerAccountsController {
// }
@RequestMapping(method = RequestMethod.GET)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER})
@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);
}
@RequestMapping(method = RequestMethod.POST)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER})
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER})
public void saveManager(@RequestBody @Valid ManagerInfo manager, Errors errors, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
HttpUtils.handleValidErrors(errors);
managerAccountsService.saveManager(manager, loginManager);
@ -61,12 +61,12 @@ public class ManagerAccountsController {
return managerAccountsService.listBDUsers(params);
}
@ManagerMapping(value = "/{userId}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER})
@ManagerMapping(value = "/{userId}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER})
public void modify(@PathVariable String userId, @RequestBody ManagerInfo manager, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
managerAccountsService.modify(userId, manager, loginManager);
}
@ManagerMapping(value = "/{userId}", method = RequestMethod.DELETE, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER})
@ManagerMapping(value = "/{userId}", method = RequestMethod.DELETE, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER})
public void disableUser(@PathVariable String userId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
managerAccountsService.disable(userId, loginManager);
}

@ -192,6 +192,7 @@
<option value="1000000">Director</option>
<option value="10000000">Site Manager</option>
<option value="100000000">Developer</option>
<option value="1000000000000">Org Manager</option>
</select>
</div>
</form>
@ -237,6 +238,7 @@
<i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i>
<i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i>
<i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i>
<i class="fa fa-user-plus" title="Org Manager" ng-class="{'text-green':manager.orgmanager,'text-gray':!manager.orgmanager}"></i>
</td>
<td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>

@ -148,7 +148,7 @@
</div>
</div>
<div class="form-group col-sm-6" ng-if="(params.org_id && orgs_child.length>1) || (currentUser.org_id && !currentUser.parent_org_id)">
<div class="form-group col-sm-6" ng-if="(params.org_id && orgs_child.length>1) || (currentUser.org_id && !currentUser.parent_org_id && orgs_child.length>1)">
<label class="control-label col-xs-4 col-sm-4" for="org-clild" ng-if="!currentUser.org_id">Sub Organization</label>
<label class="control-label col-xs-4 col-sm-4" for="org-clild" ng-if="currentUser.org_id">Organization</label>
<div class="col-xs-6 col-sm-6">

Loading…
Cancel
Save