组织管理增加二级筛选,用户管理,交易流水,增加二级代理筛选

master
yuan 7 years ago
parent 3e5c785433
commit 66775e24c2

@ -25,6 +25,10 @@ public interface OrgMapper {
List<JSONObject> listOrgs(@Param("type") int type, PageBounds order);
List<JSONObject> listOrgsWithParent(JSONObject params);
List<JSONObject> listOrgsWithChid(JSONObject params);
@AutoSql(type = SqlType.INSERT)
void saveOrg(JSONObject org);
@ -35,7 +39,7 @@ public interface OrgMapper {
void updateOrg(JSONObject org);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
@AdvanceSelect(addonWhereClause = "is_valid=1 and parent_org_id IS NULL")
List<JSONObject> listAllOrgs();
JSONObject findOrgByBDId(@Param("bd_id") int bd_id);

@ -22,6 +22,7 @@ public class PartnerQuery {
private String short_name;
private String sub_merchant_id;
private String org_id;
private String org_ids;
private Integer bd;
private String business_structure;
private String industry;
@ -117,6 +118,9 @@ public class PartnerQuery {
if (org_id != null) {
param.put("org_id", org_id);
}
if (org_ids != null) {
param.put("org_ids", org_ids);
}
if (bd != null) {
param.put("bd_user", bd);
}
@ -440,4 +444,12 @@ public class PartnerQuery {
public boolean isIs_valid() {
return is_valid;
}
public String getOrg_ids() {
return org_ids;
}
public void setOrg_ids(String org_ids) {
this.org_ids = org_ids;
}
}

@ -10,25 +10,8 @@ import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder;
import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig;
import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
@ -56,22 +39,16 @@ import au.com.royalpay.payment.tools.merchants.qrboard.QRBoard;
import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.ImageUtils;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import au.com.royalpay.payment.tools.utils.PdfUtils;
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import au.com.royalpay.payment.tools.utils.*;
import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
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 com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
@ -93,34 +70,22 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.*;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
/**
@ -327,8 +292,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
params.put("bd_user", manager.getString("manager_id"));
}
}
if(params.getString("org_id") != null){
if(params.getString("org_ids") == null){
orgIds(params,Integer.parseInt(params.getString("org_id")));
}else {
params.put("org_id",params.getString("org_ids"));
params.remove("org_ids");
}
}
JSONObject org = null;
if (params.getString("org_id") != null) {
JSONObject org = orgMapper.findOne(params.getIntValue("org_id"));
org = orgMapper.findOne(params.getIntValue("org_id"));
if (org.getIntValue("type") == 1) {
params.put("referrer_id", org.getString("org_id"));
params.remove("org_id");
@ -336,7 +311,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
int orgId = manager.getIntValue("org_id");
if (orgId > 0) {
params.put("org_id", orgId);
if(params.getString("org_ids") == null){
JSONObject org2 = orgMapper.findOne(orgId);
if(org2.getString("parent_org_id") != null){
params.put("org_id",orgId);
}else {
params.put("org_id",orgId);
orgIds(params,orgId);
}
}else {
params.put("org_id", params.getIntValue("org_ids"));
params.remove("org_ids");
}
}
String tempSubMchId = sysConfigManager.getSysConfig().getString("temp_sub_mch_id");
String tempSubMchSource = sysConfigManager.getSysConfig().getString("temp_sub_mch_id_source");
@ -361,6 +347,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return PageListUtils.buildPageListResult(partners);
}
private void orgIds(JSONObject params,int orgId){
JSONObject param = new JSONObject();
param.put("parent_org_id",params.getString("org_id"));
param.put("type",0);
List<Integer> orgIds = new ArrayList<>();
List<JSONObject> childOrgs = orgMapper.listOrgsWithChid(param);
if(childOrgs.size() > 0){
for(JSONObject object : childOrgs ){
orgIds.add(object.getIntValue("org_id"));
}
orgIds.add(orgId);
params.put("org_ids",orgIds);
params.remove("org_id");
}
}
@Override
public List<JSONObject> listPartners(JSONObject manager, PartnerQuery query) {

@ -10,7 +10,7 @@ import org.hibernate.validator.constraints.NotEmpty;
public class OrgInfo {
@NotEmpty
private String name;
private int type = 0;
private String type;
private String logo;
@NotEmpty
private String location;
@ -32,6 +32,8 @@ public class OrgInfo {
private String search_text;
private int page = 1;
private int limit = 10;
private String parent_org_id;
private String org_id;
public JSONObject toJsonParam() {
JSONObject param = new JSONObject();
@ -44,9 +46,15 @@ public class OrgInfo {
if (StringUtils.isNotBlank(search_text)) {
param.put("search_text", search_text);
}
if (StringUtils.isNotBlank(String.valueOf(type))){
if (type != null){
param.put("type", type);
}
if (StringUtils.isNotBlank(parent_org_id)){
param.put("parent_org_id", parent_org_id);
}
if (StringUtils.isNotBlank(org_id)){
param.put("org_id", org_id);
}
return param;
}
@ -126,11 +134,11 @@ public class OrgInfo {
this.rate_value = rate_value;
}
public int getType() {
public String getType() {
return type;
}
public void setType(int type) {
public void setType(String type) {
this.type = type;
}
@ -205,4 +213,20 @@ public class OrgInfo {
public void setLimit(int limit) {
this.limit = limit;
}
public String getParent_org_id() {
return parent_org_id;
}
public void setParent_org_id(String parent_org_id) {
this.parent_org_id = parent_org_id;
}
public String getOrg_id() {
return org_id;
}
public void setOrg_id(String org_id) {
this.org_id = org_id;
}
}

@ -11,9 +11,11 @@ import java.util.List;
public interface OrgManager {
List<JSONObject> listOrgs(boolean detail);
JSONObject listAllOrgs(OrgInfo orgInfo);
List<JSONObject> listOrgsWithChid(JSONObject manager,OrgInfo orgInfo);
JSONObject getOrgDetail(int orgId);
JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager);
JSONObject getOrgDetail(int orgId,JSONObject manager);
JSONObject saveNewOrg(OrgInfo org);

@ -3,7 +3,10 @@ package au.com.royalpay.payment.manage.organizations.core.impls;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.organizations.beans.OrgInfo;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
@ -11,6 +14,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -29,16 +33,47 @@ public class OrgManagerImpl implements OrgManager {
}
@Override
public JSONObject listAllOrgs(OrgInfo orgInfo) {
public List<JSONObject> listOrgsWithChid(JSONObject manager,OrgInfo orgInfo) {
JSONObject params = new JSONObject();
params.put("type",0);
List<JSONObject> listOrgsByChild = orgMapper.listOrgsWithChid(params);
if(orgInfo.getOrg_id() != null){
params.put("org_id", orgInfo.getOrg_id());
}else {
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
}
List<JSONObject> listOrgs = orgMapper.listOrgsWithParent(params);
List<JSONObject> orgs = new ArrayList<>();
for(JSONObject org : listOrgs){
org.put("type",org.getString("name"));
orgs.add(org);
for(JSONObject orgChild : listOrgsByChild){
if(org.getIntValue("org_id") == orgChild.getIntValue("parent_org_id")){
orgChild.put("type",org.getString("name"));
orgs.add(orgChild);
}
}
}
return orgs;
}
@Override
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);
}
@Override
public JSONObject getOrgDetail(int orgId) {
public JSONObject getOrgDetail(int orgId,JSONObject manager) {
checkBdRole(manager);
return orgMapper.findOne(orgId);
}
@ -86,4 +121,15 @@ 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");
}
}
}
}
}

@ -3,9 +3,11 @@ package au.com.royalpay.payment.manage.organizations.web;
import au.com.royalpay.payment.manage.organizations.beans.OrgInfo;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.tools.http.HttpUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
@ -29,10 +31,16 @@ public class OrgManageController {
return orgManager.listOrgs(detail);
}
@RequestMapping(value = "/orgChild",method = RequestMethod.GET)
@RequireManager
public List<JSONObject> listOrgsWithChid(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,OrgInfo orgInfo) {
return orgManager.listOrgsWithChid(manager,orgInfo);
}
@RequestMapping(value = "/listsOrg", method = RequestMethod.GET)
@RequireManager
public JSONObject listsOrg(OrgInfo orgInfo) {
return orgManager.listAllOrgs(orgInfo);
public JSONObject listsOrg(OrgInfo orgInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.listAllOrgs(orgInfo,manager);
}
@RequestMapping(value = "/list_all_Org", method = RequestMethod.GET)
@ -41,15 +49,15 @@ public class OrgManageController {
return orgManager.listAllOrg();
}
@ManagerMapping(method = RequestMethod.POST, role = ManagerRole.ADMIN)
@ManagerMapping(method = RequestMethod.POST, role = {ManagerRole.ADMIN,ManagerRole.BD_USER})
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)
public JSONObject getOrgDetail(@PathVariable int orgId) {
return orgManager.getOrgDetail(orgId);
@ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN,ManagerRole.BD_USER})
public JSONObject getOrgDetail(@PathVariable int orgId,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.getOrgDetail(orgId,manager);
}
@ManagerMapping(value = "/{orgId}", method = RequestMethod.PUT)
@ -58,7 +66,7 @@ public class OrgManageController {
orgManager.updateOrg(orgId, org);
}
@ManagerMapping(value = "/{orgId}/enable_change_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN})
@ManagerMapping(value = "/{orgId}/enable_change_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN,ManagerRole.BD_USER})
public void switchEnableChangeRate(@PathVariable int orgId, @RequestBody JSONObject enable){
boolean enabled = enable.getBooleanValue("enabled");
orgManager.switchPermission(orgId,"rate_editable",enabled);

@ -2,6 +2,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.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
@ -22,11 +23,15 @@ import java.util.List;
public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Resource
private ManagerMapper managerMapper;
@Resource
private OrgMapper orgMapper;
@Resource
private FinancialBDConfigMapper financialBDConfigMapper;
@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"));
@ -52,7 +57,8 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override
public void saveManager(ManagerInfo manager, JSONObject loginManager) {
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role"))) {
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");
}
@ -67,12 +73,13 @@ 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");
}
JSONObject obj = manager.accountJson(false);
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role"))) {
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))) {
if (managerFromDb.getIntValue("org_id") != loginManager.getIntValue("org_id")) {
throw new BadRequestException("You cannot modify accounts belong to other organizations");
}
@ -87,8 +94,9 @@ 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"))) {
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))){
if (manager.getIntValue("org_id") != loginManager.getIntValue("org_id")) {
throw new BadRequestException("You cannot disable accounts belong to other organizations");
}
@ -117,4 +125,16 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
public JSONObject getBDConfig(String bd_id){
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");
}
}
}
}
}

@ -32,10 +32,7 @@ import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* account service for sign in
@ -67,11 +64,14 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
@Cacheable(value = ":login:managers:", key = "''+#accountId")
public JSONObject getManager(String accountId) {
JSONObject manager = managerMapper.findById(accountId);
JSONObject org = null;
if (manager == null) {
throw new ForbiddenException("用户不存在或已禁用");
}
if (manager.getInteger("org_id") != null) {
manager.put("org", orgMapper.findOne(manager.getIntValue("org_id")));
org = orgMapper.findOne(manager.getIntValue("org_id"));
manager.put("org", org);
manager.put("parent_org_id",org.getIntValue("parent_org_id"));
}
List<JSONObject> funcs = permissionManager.listUserFunctions(manager.getIntValue("role"));
List<String> funcIds = new ArrayList<>();
@ -90,12 +90,36 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
modules.put(module, mod);
}
}
if(org != null && org.getIntValue("type")==0 && org.getString("parent_org_id") != null){
if(modules.containsKey("org")){
deleteOrgModule(modules,"org");
}
if(modules.containsKey("manager_accounts")){
deleteOrgModule(modules,"manager_accounts");
}
}
if(org != null && org.getIntValue("type")==0 && org.getString("parent_org_id") == null){
if(modules.containsKey("manager_accounts")){
deleteOrgModule(modules,"manager_accounts");
}
}
manager.put("available_func_ids", funcIds);
manager.put("available_func_names", funcNames);
manager.put("modules", modules.values());
manager.put("module_names", modules.keySet());
return manager;
}
private void deleteOrgModule(Map<String, JSONObject> modules,String module){
Iterator iterator = modules.keySet().iterator();
while (iterator.hasNext()) {
String key = (String) iterator.next();
if (module.equals(key)) {
iterator.remove();
modules.remove(key);
}
}
}
@Override
@Cacheable(value = ":login:clients:", key = "''+#accountId")

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

@ -36,6 +36,7 @@ public class TradeLogQuery {
private int trans_type;
private boolean onlyGroup = false;
private int group_bd;
private String org_id;
public JSONObject toParams(String timezone) {
JSONObject params = new JSONObject();
@ -91,6 +92,9 @@ public class TradeLogQuery {
if (getDev_id() != null) {
params.put("dev_id", getDev_id());
}
if (org_id != null && org_id != "ALL") {
params.put("org_id", org_id);
}
return params;
}
@ -214,4 +218,12 @@ public class TradeLogQuery {
public void setChannel(PayChannel channel) {
this.channel = channel;
}
public String getOrg_id() {
return org_id;
}
public void setOrg_id(String org_id) {
this.org_id = org_id;
}
}

@ -18,6 +18,7 @@ import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
@ -119,6 +120,9 @@ public class TradeLogServiceImpl implements TradeLogService {
@Resource
private ClientCustomersMapper clientCustomersMapper;
@Resource
private OrgMapper orgMapper;
// @Value("classpath:/jasper/trans_flow.jasper")
// @Value("classpath:/jasper/trans_flow_new.jasper")
@Value("classpath:/jasper/partner_invoice.jasper")
@ -176,7 +180,26 @@ public class TradeLogServiceImpl implements TradeLogService {
}
}
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
if(params.getString("org_id") == null) {
JSONObject org = orgMapper.findOne(manager.getInteger("org_id"));
if(org.getString("parent_org_id") != null){
params.put("org_id",manager.getInteger("org_id"));
}else {
JSONObject param = new JSONObject();
param.put("parent_org_id", manager.getIntValue("org_id"));
param.put("type", 0);
List<Integer> orgIds = new ArrayList<>();
List<JSONObject> childOrgs = orgMapper.listOrgsWithChid(param);
if(childOrgs.size()>0){
for (JSONObject object : childOrgs) {
orgIds.add(object.getIntValue("org_id"));
}
orgIds.add(manager.getIntValue("org_id"));
params.put("org_ids", orgIds);
}
}
}
}
PageList<JSONObject> logs = orderMapper.listOrders(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
JSONObject result = PageListUtils.buildPageListResult(logs);

@ -172,6 +172,8 @@
</if>
</if>
<if test="order_id!=null">and o.order_id=#{order_id}</if>
<if test="org_ids!=null">and p.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="trade_type!=null">and o.gateway in
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach>
</if>

@ -150,6 +150,8 @@
</if>
</if>
<if test="org_id!=null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="referrer_id!=null">and c.referrer_id=#{referrer_id}</if>
<if test="is_valid">and c.is_valid=1</if>
</where>

@ -8,6 +8,29 @@
</if>
</select>
<select id="listOrgsWithParent" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_org WHERE is_valid=1 AND parent_org_id is NULL
<if test="type!=null">
and type=#{type}
</if>
<if test="org_id!=null">
and org_id=#{org_id}
</if>
</select>
<select id="listOrgsWithChid" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_org WHERE is_valid=1 AND parent_org_id is NOT NULL
<if test="type!=null">
and type=#{type}
</if>
<if test="org_id!=null">
and org_id=#{org_id}
</if>
<if test="parent_org_id!=null">
and parent_org_id=#{parent_org_id}
</if>
</select>
<!--<select id="getReferres" resultType="com.alibaba.fastjson.JSONObject">-->
<!--SELECT m.manager_id,m.display_name,o.org_id,o.name org_name FROM sys_managers m-->
<!--RIGHT JOIN sys_org o on o.org_id = m.org_id-->
@ -37,6 +60,13 @@
<if test="name!=null">
and org.name=#{name}
</if>
<if test="parent_org_id!=null">
and org.parent_org_id=#{parent_org_id}
</if>
<if test="org_id!=null">
and (org.org_id=#{org_id} or org.parent_org_id=#{org_id})
</if>
</where>
</select>
</mapper>

@ -33,17 +33,26 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
})
}]);
app.controller('orgsCtrl', ['$scope', '$http','commonDialog', function ($scope, $http,commonDialog ) {
$scope.params = {type:0};
$scope.params = {};
if($scope.currentUser.org_id !=null && !angular.equals({}, $scope.currentUser.org_id)) {
$scope.params.org_id = $scope.currentUser.org_id;
}
$scope.pagination = {};
$scope.types = angular.copy(types);
$scope.listOrgs = function (page) {
var params = angular.copy( $scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/orgs/listsOrg',{params:params}).then(function (resp) {
$scope.orgs = resp.data.data;
$scope.orgs_detail = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};
if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) {
$scope.showOrg = 'Organization';
$http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) {
$scope.orgs = resp.data;
});
}
$scope.disableOrg = function (org) {
$scope.org =angular.copy(org);
$scope.org.is_valid = 0;
@ -63,6 +72,9 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal','commonDialog', 'org', function ($scope, $http, $state, Upload,$uibModal,commonDialog, org) {
$scope.types = angular.copy(types);
$scope.org = angular.copy(org.data);
if ($scope.currentUser.org_id != null) {
$scope.org.type = 0;
}
$scope.uploadLogo = function (file) {
if (file == null) {
return;
@ -183,6 +195,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
});
return;
}
if($scope.currentUser.org_id !=null && !angular.equals({}, $scope.currentUser.org_id)) {
$scope.org.parent_org_id = angular.copy($scope.currentUser.org.org_id);
$scope.org.type = '0';
}
$http.post('/sys/orgs', $scope.org).then(function (resp) {
commonDialog.alert({
title: 'Succeed',

@ -64,7 +64,8 @@
required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}">
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}"
ng-show="!currentUser.org_id">
<label class="control-label col-sm-2" for="org_type_input">Type *</label>
<div class="col-sm-8">
<!--<select class="form-control" ng-model="org.type" ng-init="org.type=0" id="org_type_input">-->
@ -88,7 +89,7 @@
</div>
</div>
</div>
<div ng-if="org.type == 0">
<div ng-if="org.type == 0 || currentUser.org_id !=null">
<div class="form-group"
ng-class="{'has-error':org_form.alipay_rate_value.$invalid && org_form.alipay_rate_value.$dirty}">
<label class="control-label col-sm-2" for="alipay_rate_value_input">Alipay rate *</label>

@ -50,7 +50,8 @@
<input class="form-control" ng-model="org.location" id="org_location_input" name="location" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}">
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}"
ng-if="!currentUser.org_id">
<label class="control-label col-sm-2" for="org_type_input">Type *</label>
<div class="col-sm-8">
<!--<select class="form-control" ng-model="org.type" ng-init="org.type=0" id="org_type_input">-->

@ -86,15 +86,22 @@
<div class="form-horizontal">
<div class="form-group ">
<div class="col-sm-6">
<div>
<!-- <div ng-if="currentUser.org_id==null">
<label class="col-xs-4 col-sm-5">
<select class="form-control" name="type" required ng-model="params.type"
id="org_type_input"
ng-options="type.value as type.label for type in types"
ng-change="listOrgs(1)">
<!--<option value="">Please Choose</option>-->
&lt;!&ndash;<option value="">Please Choose</option>&ndash;&gt;
</select>
</label>
</div>-->
<div class="form-group col-sm-5" ng-if="orgs">
<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="listOrgs();">
<option value="">Organizations</option>
</select>
</div>
<div class="col-xs-4 col-sm-6">
<input class="form-control" type="text" placeholder="请输入姓名或联系人"
@ -135,7 +142,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="org in orgs"
<tr ng-repeat="org in orgs_detail"
ng-class="{'delete':org.is_valid==0}">
<td ng-if="org.logo">
<img ng-src="{{org.logo}}" style="height: 30px;width: 30px;">
@ -144,7 +151,8 @@
<img src="/static/images/r_logo.svg"
style="height: 30px;width:30px">
</td>
<td>{{org.name}}</td>
<td>{{org.name}} <i class="fa fa-sitemap" ng-if="org.parent_org_id"
title="Sub Partner"></i></td>
<td>{{org.location}}</td>
<td>{{org.contact_person}}</td>
<td>{{org.contact_phone}}</td>

@ -122,7 +122,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) {
$scope.analysisClients();
}
$scope.pagination = {};
$scope.industries = industryMap.configs();
$scope.states = stateMap.configs();
@ -131,7 +130,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.business_structures = businessStructuresMap.configs();
$scope.clean_days = angular.copy(clean_days_map);
$scope.bd_citys = angular.copy(bd_city_map);
$scope.params = {textType: 'all'};
$scope.params = {textType: 'all',org_name:'ALL'};
$scope.loadPartners = function (page) {
var params = angular.copy($scope.params);
@ -165,6 +164,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
}
$scope.loadOrgs = function () {
var params = angular.copy($scope.params);
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
$scope.orgs_child = resp.data;
})
};
$scope.loadOrgs();
/* $scope.onOrgsSelect = function (selectedItem) {
$scope.params.org_id = selectedItem.org_id;
$scope.params.org_name = selectedItem.label;
$scope.loadPartners();
};
*/
/* $scope.chooseOrg = function (org) {
if (org == 'all') {
delete $scope.params.org_id;

@ -142,11 +142,34 @@
<div class="col-xs-6 col-sm-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.bd = '';loadPartners()">
ng-change="params.bd = '';params.org_ids = null;loadPartners();loadOrgs();">
<option value="">All</option>
</select>
</div>
</div>
<div class="form-group col-sm-6" ng-if="(params.org_id) || (currentUser.org_id && !currentUser.parent_org_id) ">
<label class="control-label col-xs-4 col-sm-4" for="org-clild" ng-if="!currentUser.org_id">Org Child</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">
<select id="org-clild" class="form-control" ng-model="params.org_ids"
ng-options="org.org_id as org.name group by org.type for org in orgs_child"
ng-change="params.bd = '';loadPartners();">
<option value="">All</option>
</select>
</div>
</div>
<!-- <div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4" for="bd-select">Org
Child</label>
<div class="col-xs-6 col-sm-6">
<input class="form-control" id="org_id"
name="params.org_name"
ng-model="params.org_name"
multi-level-select-popup="orgs_child"
on-select="onOrgsSelect($selected)">
</div>
</div>-->
<!-- <div class="form-group col-sm-6" ng-if="orgs">
<label class="control-label col-xs-4 col-sm-4">Organization</label>
<div class="col-xs-6">
@ -313,7 +336,7 @@
</div>
</div>
<!--status-->
<div class="form-group" ng-if="'10'|withRole">
<div class="form-group col-sm-12" ng-if="'10'|withRole">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<!--<div class="col-xs-8 col-sm-4">-->
<span class="col-xs-8 col-sm-10">

@ -56,6 +56,16 @@
<input class="form-control" placeholder="Keyword" ng-enter="loadTradeLogs(1)"
ng-model="params.searchText">
</div>
<div class="col-sm-6 col-xs-8" ng-if="orgs.length>1 && currentUser.org_id">
<label class="control-label col-xs-3 col-sm-4">Organization</label>
<div class="col-xs-9 col-sm-8">
<select id="org-clild" class="form-control" ng-model="params.org_id"
ng-options="org.org_id as org.name group by org.type for org in orgs"
ng-change="loadTradeLogs(1)">
<option value="">All</option>
</select>
</div>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>

@ -17,7 +17,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}]);
app.controller('globalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService',
function ($scope, $http, $filter, commonDialog, refunder, orderService) {
$scope.params = {status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date()};
$scope.params = {status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date(),org_name:'ALL'};
$scope.pagination = {};
$scope.today = new Date();
@ -76,6 +76,14 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1);
};
$scope.loadOrgs = function () {
$http.get('/sys/orgs/orgChild').then(function (resp) {
$scope.orgs = resp.data;
})
};
$scope.loadOrgs();
$scope.loadTradeLogs = function (page) {
var params = angular.copy($scope.params);
if (params.datefrom) {

Loading…
Cancel
Save