fix Accounts

master
yuan 6 years ago
parent 6cf637bfec
commit 20f15d7c64

@ -4,6 +4,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -15,5 +16,5 @@ public interface LogClientSubMerchantIdMapper {
void save(JSONObject log);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> listLogsByClientId(@Param("client_id") int client_id);
List<JSONObject> listLogsByClientId(@Param("client_id") int client_id, PageBounds pageBounds);
}

@ -6,6 +6,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -32,7 +33,7 @@ public interface ManagerMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject account);
List<JSONObject> listAvailable(JSONObject params, PageBounds pageBounds);
PageList<JSONObject> listAvailable(JSONObject params, PageBounds pageBounds);
@AutoSql(type = SqlType.INSERT)
void save(JSONObject manager);

@ -333,7 +333,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int role = manager != null ? manager.getIntValue("role") : 0;
if (manager != null) {
if (ManagerRole.OPERATOR.hasRole(role)) {
List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"));
List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
client.put("sub_merchant_id_log", log.size() > 0 ? true : false);
}
if (ManagerRole.BD_USER.hasRole(role)) {
@ -3579,7 +3579,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
return logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"));
return logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
}
@Override

@ -0,0 +1,127 @@
package au.com.royalpay.payment.manage.signin.beans;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
/**
* Created by yuan on 2018/7/13.
*/
public class QueryManagerBean {
private String org_id;
private String org_id2;
private String role;
private String username;
private int page = 1;
private int limit = 10;
public JSONObject toJson(){
JSONObject params = new JSONObject();
if (StringUtils.isNotEmpty(org_id)){
params.put("org_id",org_id);
}
if (StringUtils.isNotEmpty(org_id2)){
params.put("org_id2",org_id2);
}
if (StringUtils.isNotEmpty(role)){
int mask = 0;
if(role.equals("1")){
mask = ManagerRole.ADMIN.getMask();
}
if(role.equals("10")){
mask = ManagerRole.OPERATOR.getMask();
}
if(role.equals("100")){
mask = ManagerRole.BD_USER.getMask();
}
if(role.equals("1000")){
mask = ManagerRole.FINANCIAL_STAFF.getMask();
}
if(role.equals("10000")){
mask = ManagerRole.SERVANT.getMask();
}
if(role.equals("100000")){
mask = ManagerRole.ACCOUNT_MANAGER.getMask();
}
if(role.equals("1000000")){
mask = ManagerRole.DIRECTOR.getMask();
}
if(role.equals("10000000")){
mask = ManagerRole.SITE_MANAGER.getMask();
}
if(role.equals("100000000")){
mask = ManagerRole.DEVELOPER.getMask();
}
if(role.equals("1000000000")){
mask = ManagerRole.BD_LEADER.getMask();
}
if(role.equals("10000000000")){
mask = ManagerRole.RISK_MANAGER.getMask();
}
if(role.equals("100000000000")){
mask = ManagerRole.GUEST.getMask();
}
if(role.equals("1000000000000")){
mask = ManagerRole.ORG_MANAGER.getMask();
}
if(mask != 0){
params.put("mask",mask);
}
}
if (StringUtils.isNotEmpty(username)){
params.put("username",username);
}
params.put("page",page);
params.put("limit",10);
return params;
}
public String getOrg_id() {
return org_id;
}
public void setOrg_id(String org_id) {
this.org_id = org_id;
}
public String getOrg_id2() {
return org_id2;
}
public void setOrg_id2(String org_id2) {
this.org_id2 = org_id2;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.signin.core;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import java.util.List;
@ -9,7 +10,7 @@ import java.util.List;
* Created by yixian on 2016-07-05.
*/
public interface ManagerAccountsService {
List<JSONObject> listManagers(JSONObject loginManager,JSONObject params);
PageList<JSONObject> listManagers(JSONObject loginManager, JSONObject params);
void saveManager(ManagerInfo manager, JSONObject loginManager);

@ -12,6 +12,7 @@ import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -35,12 +36,12 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
private OrgManager orgManager;
@Override
public List<JSONObject> listManagers(JSONObject loginManager,JSONObject params) {
public PageList<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")));
PageList<JSONObject> managers = managerMapper.listAvailable(params, new PageBounds(params.getIntValue("page"),params.getIntValue("limit"),Order.formString("create_time.desc")));
for (JSONObject manager : managers) {
int role = manager.getIntValue("role");
manager.put("admin", ManagerRole.ADMIN.hasRole(role));

@ -2,12 +2,14 @@ package au.com.royalpay.payment.manage.signin.web;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.signin.beans.QueryManagerBean;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
@ -38,15 +40,9 @@ 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(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);
public JSONObject listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, QueryManagerBean queryManagerBean) {
return PageListUtils.buildPageListResult(managerAccountsService.listManagers(loginManager,queryManagerBean.toJson()));
}
@RequestMapping(method = RequestMethod.POST)

@ -27,8 +27,15 @@
) o
ON m.wx_openid = o.wechat_openid
<where>
<if test="org_id!=null and org_ids==null">m.org_id=#{org_id}</if>
<if test="org_ids!=null">m.org_id in
<if test="username!=null">
<bind name="username_pattern" value="'%'+username+'%'"/>
and m.username like #{username_pattern}
</if>
<if test="mask!=null">
and <![CDATA[ m.role & #{mask} >0 ]]>
</if>
<if test="org_id!=null and org_ids==null"> AND m.org_id=#{org_id}</if>
<if test="org_ids!=null"> AND m.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
and m.is_valid=1
</where>

@ -12,12 +12,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
})
}]);
app.controller('managerListCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog', function ($scope, $http,$filter, $uibModal, commonDialog) {
$scope.search = {role:'111111111111'};
$scope.params = {};
$scope.listManagers = function () {
$scope.params = {role:"111111111111"};
$scope.pagination = {};
$scope.listManagers = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/manager_accounts',{params: params}).then(function (resp) {
$scope.managers = resp.data;
$scope.managers = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};
if($filter('withRole')('1')){

@ -11,15 +11,18 @@
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<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 class="form-horizontal">
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4" for="username-search">Username</label>
<div class="col-xs-6">
<input type="text" class="form-control" ng-model="params.username" placeholder="Username" id="username-search">
</div>
<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">
</div>
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="role-select">Role</label>
<div class="col-xs-6">
<select ng-change="listManagers(1)" class="form-control" id="role-select" ng-model="params.role">
<option value="111111111111">All</option>
<option value="1">Administrator</option>
<option value="10">Compliance</option>
@ -35,86 +38,104 @@
<option value="100000000000">Guest</option>
<option value="1000000000000">Org Manager</option>
</select>
</div>
<div class="form-group" ng-if="('1'|withRole)">
</div>
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="org-select">All Organizations</label>
<div class="col-xs-6">
<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="params.org_id2 = '';listManagers();loadOrgsChild(params.org_id)">
ng-change="params.org_id2 = '';listManagers(1);loadOrgsChild(params.org_id)">
<option value="">All Organizations</option>
</select>
</div>
<div ng-if="(orgs_child.length > 1)&&('1'|withRole)&&params.org_id">
</div>
<div class="form-group col-sm-6" ng-if="(orgs_child.length > 1)&&('1'|withRole)&&params.org_id">
<label class="control-label col-xs-4 col-sm-4"
for="org-child-select">Sub Organizations</label>
<div class="col-xs-6">
<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()">
ng-change="listManagers(1)">
<option value="">Sub Organizations</option>
</select>
</div>
<!--<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="org-select">Organizations</label>
<select class="form-control" id="org-select" ng-model="search.org_id" ng-options="o.org_id as o.name for o in orgs">
<option value="">All</option>
</select>
</div>-->
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
</div>
<div class="col-xs-12">
<button class="btn btn-primary" type="button" ng-click="listManagers(1)">
<i class="fa fa-search"></i> Search
</button>
<button class="btn btn-info" type="button " ng-click="newManager()">
<i class="fa fa-plus"></i> New Manager Account
</button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-body">
<div class="row">
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Display Name</th>
<th>Wechat</th>
<th>Create Time</th>
<th>Email</th>
<th ng-if="!search.org_id">Organization</th>
<th>Roles</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="manager in managers|managersFilter:search">
<td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
<td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="manager.email"></td>
<td ng-bind="manager.org_name" ng-if="!search.org_id"></td>
<td>
<i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i>
<i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i>
<i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i>
<i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i>
<i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i>
<i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i>
<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-male" title="BD Leader" ng-class="{'text-green':manager.bdleader,'text-gray':!manager.bdleader}"></i>
<i class="fa fa-user" title="Risk Manager" ng-class="{'text-green':manager.riskmanager,'text-gray':!manager.riskmanager}"></i>
<i class="fa fa-tripadvisor" title="GUEST" ng-class="{'text-green':manager.guest,'text-gray':!manager.guest}"></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>
|
<a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a>
</td>
</tr>
</tbody>
</table>
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Display Name</th>
<th>Wechat</th>
<th>Create Time</th>
<th>Email</th>
<th>Organization</th>
<th>Roles</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="manager in managers">
<td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
<td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="manager.email"></td>
<td ng-bind="manager.org_name"></td>
<td>
<i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i>
<i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i>
<i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i>
<i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i>
<i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i>
<i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i>
<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-male" title="BD Leader" ng-class="{'text-green':manager.bdleader,'text-gray':!manager.bdleader}"></i>
<i class="fa fa-user" title="Risk Manager" ng-class="{'text-green':manager.riskmanager,'text-gray':!manager.riskmanager}"></i>
<i class="fa fa-tripadvisor" title="GUEST" ng-class="{'text-green':manager.guest,'text-gray':!manager.guest}"></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>
|
<a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="managers.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="listManagers()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</div>
</div>
</div>

@ -141,10 +141,15 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
})
};
$scope.search = {role:'1111111'};
$scope.listManagers = function () {
$http.get('/sys/manager_accounts',{params:{org_id:$scope.org.org_id}}).then(function (resp) {
$scope.managers = resp.data;
$scope.params = {role:'1111111',org_id:$scope.org.org_id};
$scope.pagination = {};
$scope.listManagers = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/manager_accounts',{params:params}).then(function (resp) {
$scope.managers = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};

@ -305,11 +305,11 @@
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<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">
<input type="text" class="form-control" ng-model="params.username" placeholder="Username" id="username-filter-input">
</div>
<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">
<select ng-change="listManagers(1)" class="form-control" id="role-filter-select" ng-model="params.role">
<option value="1111111">All</option>
<option value="1">Administrator</option>
<option value="10">Compliance</option>
@ -323,6 +323,12 @@
<option value="1000000000000">Org Manager</option>
</select>
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="listManagers(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
@ -350,7 +356,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="manager in managers|managersFilter:search">
<tr ng-repeat="manager in managers">
<td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
@ -377,6 +383,22 @@
</tbody>
</table>
</div>
<div class="box-footer" ng-if="managers.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="listManagers()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</div>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save