master
wangning 7 years ago
commit eefec84fc7

@ -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_clients_customers ADD COLUMN last_payment_time datetime DEFAULT NULL COMMENT '最后一次付款时间';
ALTER TABLE sys_org ADD COLUMN parent_org_id int(11) DEFAULT NULL;

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.analysis.web;
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean; import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
import au.com.royalpay.payment.manage.analysis.core.DashboardService; import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequirePartner; import au.com.royalpay.payment.manage.permission.manager.RequirePartner;
@ -20,32 +21,28 @@ import java.util.List;
public class DashboardController { public class DashboardController {
@Resource @Resource
private DashboardService dashboardService; private DashboardService dashboardService;
@Resource
private OrgManager orgManager;
@ManagerMapping("/common_analysis_1") @ManagerMapping("/common_analysis_1")
public JSONObject commonAnalysis1(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public JSONObject commonAnalysis1(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
return dashboardService.getCommonAnalysis1(params); return dashboardService.getCommonAnalysis1(params);
} }
@ManagerMapping("/common_analysis_2") @ManagerMapping("/common_analysis_2")
public JSONObject commonAnalysis2(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public JSONObject commonAnalysis2(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
return dashboardService.getCommonAnalysis2(params); return dashboardService.getCommonAnalysis2(params);
} }
@ManagerMapping("/trade_in_types") @ManagerMapping("/trade_in_types")
public List<JSONObject> tradeInTypes(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public List<JSONObject> tradeInTypes(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
return dashboardService.getTradeInTypes(params); return dashboardService.getTradeInTypes(params);
} }
@ -53,18 +50,14 @@ public class DashboardController {
public List<JSONObject> topTradePartners(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, public List<JSONObject> topTradePartners(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,
@RequestParam(defaultValue = "10") int limit) { @RequestParam(defaultValue = "10") int limit) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
return dashboardService.getTopTradePartners(params, limit); return dashboardService.getTopTradePartners(params, limit);
} }
@ManagerMapping("/rank_trade_partners") @ManagerMapping("/rank_trade_partners")
public List<JSONObject> rankTradePartners(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public List<JSONObject> rankTradePartners(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) { if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id")); params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){ if (analysis.getGroup_bd()>0){
@ -77,9 +70,7 @@ public class DashboardController {
@ManagerMapping("/trade_in_hours") @ManagerMapping("/trade_in_hours")
public List<JSONObject> tradeInHours(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public List<JSONObject> tradeInHours(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) { if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id")); params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){ if (analysis.getGroup_bd()>0){
@ -92,18 +83,14 @@ public class DashboardController {
@ManagerMapping("/fee_analysis") @ManagerMapping("/fee_analysis")
public List<JSONObject> tradeInDays(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public List<JSONObject> tradeInDays(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
return dashboardService.getTradeAnalysisInDays(params); return dashboardService.getTradeAnalysisInDays(params);
} }
@ManagerMapping("/partners_in_types") @ManagerMapping("/partners_in_types")
public List<JSONObject> partnersInTypes(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public List<JSONObject> partnersInTypes(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) { if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id")); params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){ if (analysis.getGroup_bd()>0){
@ -118,9 +105,7 @@ public class DashboardController {
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
params.put("trade_type", trade_type); params.put("trade_type", trade_type);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) { if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id")); params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){ if (analysis.getGroup_bd()>0){
@ -134,9 +119,7 @@ public class DashboardController {
@ManagerMapping("/trade_in_time") @ManagerMapping("/trade_in_time")
public List<JSONObject> tradeInTime(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public List<JSONObject> tradeInTime(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
return dashboardService.getTradeAnalysisInTime(params); return dashboardService.getTradeAnalysisInTime(params);
} }
@ -154,9 +137,7 @@ public class DashboardController {
@ManagerMapping("/Total_platform_amount") @ManagerMapping("/Total_platform_amount")
public JSONObject getPlatformAmount(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ public JSONObject getPlatformAmount(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){
JSONObject params = analysis.toParams(null); JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
params.put("org_id", manager.getIntValue("org_id"));
}
return dashboardService.getPlatformAmount(params); return dashboardService.getPlatformAmount(params);
} }
} }

@ -440,7 +440,7 @@ public class RetailAppServiceImp implements RetailAppService {
@Override @Override
public void updateDevToken(JSONObject device, String devToken) { public void updateDevToken(JSONObject device, String devToken) {
deviceSupport.updateIphoneMessageToken(device, devToken); deviceSupport.updateDeviceMessageToken(device, devToken);
} }
@Override @Override

@ -24,6 +24,7 @@ public class SendWechatMessage {
private boolean bdleader; private boolean bdleader;
private boolean riskmanager; private boolean riskmanager;
private boolean guest; private boolean guest;
private boolean orgmanager;
public JSONObject insertObject() { public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this); JSONObject res = (JSONObject) JSON.toJSON(this);
@ -157,4 +158,12 @@ public class SendWechatMessage {
public void setGuest(boolean guest) { public void setGuest(boolean guest) {
this.guest = guest; this.guest = guest;
} }
public boolean isOrgmanager() {
return orgmanager;
}
public void setOrgmanager(boolean orgmanager) {
this.orgmanager = orgmanager;
}
} }

@ -117,6 +117,9 @@ public class WechatMessageServiceImpl implements WechatMessageService {
if(sendWechatMessage.isDirector()){ if(sendWechatMessage.isDirector()){
set = getOpenIdSet(set, ManagerRole.DIRECTOR.getMask()); set = getOpenIdSet(set, ManagerRole.DIRECTOR.getMask());
} }
if(sendWechatMessage.isOrgmanager()){
set = getOpenIdSet(set, ManagerRole.ORG_MANAGER.getMask());
}
for(String open_id : set){ for(String open_id : set){
object.put("open_id",open_id); object.put("open_id",open_id);
sendWecharMessageByOpenId(object); sendWecharMessageByOpenId(object);

@ -314,6 +314,7 @@ public class TestController implements ApplicationEventPublisherAware {
elem = alipayClient.onlineRefund(refundOrder, type == TradeType.GATEWAY_H5); elem = alipayClient.onlineRefund(refundOrder, type == TradeType.GATEWAY_H5);
xmlStr = XmlFormatUtils.formatXml(elem); xmlStr = XmlFormatUtils.formatXml(elem);
res.put("xml", xmlStr); res.put("xml", xmlStr);
break;
default: default:
throw new BadRequestException("Not Support channel:" + channel); throw new BadRequestException("Not Support channel:" + channel);
} }

@ -45,4 +45,6 @@ public interface OrgMapper {
JSONObject findOrgByBDId(@Param("bd_id") int bd_id); JSONObject findOrgByBDId(@Param("bd_id") int bd_id);
PageList<JSONObject> listOrgWithPages(JSONObject paraams, PageBounds order); PageList<JSONObject> listOrgWithPages(JSONObject paraams, PageBounds order);
List<JSONObject> listOrgAndChild(@Param("org_id") int org_id);
} }

@ -214,7 +214,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); checkClientOrg(manager, client);
client.put("show_all_permission", true); client.put("show_all_permission", true);
int role = manager != null ? manager.getIntValue("role") : 0; int role = manager != null ? manager.getIntValue("role") : 0;
if (manager != null) { if (manager != null) {
@ -274,6 +274,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return client; return client;
} }
private void checkClientOrg(JSONObject manager, JSONObject client) {
if (manager.getInteger("org_id")!=null){
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
if (org.getInteger("parent_org_id")!=null){
if (org.getIntValue("parent_org_id")!=manager.getIntValue("org_id")){
throw new ForbiddenException("The org of client is not belong to you");
}
}else {
checkOrgPermission(manager, client);
}
}
}
@Override @Override
public JSONObject getClientDetailById(int clientId) { public JSONObject getClientDetailById(int clientId) {
JSONObject client = getClientInfo(clientId); JSONObject client = getClientInfo(clientId);
@ -1388,7 +1401,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); checkClientOrg(manager,client);
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
params.put("is_valid", "1"); params.put("is_valid", "1");

@ -27,4 +27,5 @@ public interface OrgManager {
List<JSONObject> listAllOrg(); List<JSONObject> listAllOrg();
JSONObject checkOrg(JSONObject manager, JSONObject params);
} }

@ -4,6 +4,7 @@ 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.beans.OrgInfo;
import au.com.royalpay.payment.manage.organizations.core.OrgManager; import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
@ -11,12 +12,14 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* Created by yixian on 2016-10-18. * Created by yixian on 2016-10-18.
@ -65,7 +68,6 @@ public class OrgManagerImpl implements OrgManager {
public JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager) { public JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager) {
/* PageBounds sort = new PageBounds(Order.formString("sort_no.asc")); /* PageBounds sort = new PageBounds(Order.formString("sort_no.asc"));
return orgMapper.listsOrgWithDetail(sort);*/ return orgMapper.listsOrgWithDetail(sort);*/
checkBdRole(manager);
JSONObject params = orgInfo.toJsonParam(); JSONObject params = orgInfo.toJsonParam();
PageList<JSONObject> listOrg = orgMapper.listOrgWithPages(params,new PageBounds(orgInfo.getPage(),orgInfo.getLimit(),Order.formString("sort_no.asc"))); PageList<JSONObject> listOrg = orgMapper.listOrgWithPages(params,new PageBounds(orgInfo.getPage(),orgInfo.getLimit(),Order.formString("sort_no.asc")));
return PageListUtils.buildPageListResult(listOrg); return PageListUtils.buildPageListResult(listOrg);
@ -73,7 +75,6 @@ public class OrgManagerImpl implements OrgManager {
@Override @Override
public JSONObject getOrgDetail(int orgId,JSONObject manager) { public JSONObject getOrgDetail(int orgId,JSONObject manager) {
checkBdRole(manager);
return orgMapper.findOne(orgId); return orgMapper.findOne(orgId);
} }
@ -121,15 +122,30 @@ public class OrgManagerImpl implements OrgManager {
return listAllOrgs; return listAllOrgs;
} }
private void checkBdRole(JSONObject manager){ @Override
if(ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))){ public JSONObject checkOrg(JSONObject manager, JSONObject params){
if(manager.getString("org_id") != null){ if (params.getString("org_id")==null){
JSONObject org = orgMapper.findOne(manager.getIntValue("org_id")); if (manager.getInteger("org_id")!=null){
if(org != null && org.getIntValue("type") == 0 && org.getString("parent_org_id") != null){ List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id"));
throw new BadRequestException("Invalid Role"); if (orgs.size()>1){
List<Integer> orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList());
params.put("org_ids",orgIds);
}else {
params.put("org_id",manager.getIntValue("org_id"));
}
} }
}else {
if (manager.getInteger("org_id")!=null){
List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id"));
List<Integer> orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList());
if (!orgIds.contains(params.getString("org_id"))){
throw new ForbiddenException("You have no permission to query the org");
} }
}
} }
return params;
} }
} }

@ -49,13 +49,13 @@ public class OrgManageController {
return orgManager.listAllOrg(); 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) { public JSONObject saveOrg(@RequestBody @Valid OrgInfo org, Errors errors) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
return orgManager.saveNewOrg(org); 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) { public JSONObject getOrgDetail(@PathVariable int orgId,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.getOrgDetail(orgId,manager); return orgManager.getOrgDetail(orgId,manager);
} }
@ -66,7 +66,7 @@ public class OrgManageController {
orgManager.updateOrg(orgId, org); 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){ public void switchEnableChangeRate(@PathVariable int orgId, @RequestBody JSONObject enable){
boolean enabled = enable.getBooleanValue("enabled"); boolean enabled = enable.getBooleanValue("enabled");
orgManager.switchPermission(orgId,"rate_editable",enabled); orgManager.switchPermission(orgId,"rate_editable",enabled);

@ -37,6 +37,7 @@ public class ManagerInfo {
private boolean bdleader; private boolean bdleader;
private boolean riskmanager; private boolean riskmanager;
private boolean guest; private boolean guest;
private boolean orgmanager;
@JSONField(name = "org_id") @JSONField(name = "org_id")
private Integer orgId; private Integer orgId;
@ -101,6 +102,9 @@ public class ManagerInfo {
if (guest){ if (guest){
role |= ManagerRole.GUEST.getMask(); role |= ManagerRole.GUEST.getMask();
} }
if (orgmanager){
role |= ManagerRole.ORG_MANAGER.getMask();
}
account.put("role", role); account.put("role", role);
if (insert) { if (insert) {
account.put("username", getUsername()); account.put("username", getUsername());
@ -260,4 +264,12 @@ public class ManagerInfo {
public void setGuest(boolean guest) { public void setGuest(boolean guest) {
this.guest = guest; this.guest = guest;
} }
public boolean isOrgmanager() {
return orgmanager;
}
public void setOrgmanager(boolean orgmanager) {
this.orgmanager = orgmanager;
}
} }

@ -31,7 +31,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override @Override
public List<JSONObject> listManagers(JSONObject loginManager) { public List<JSONObject> listManagers(JSONObject loginManager) {
checkBdRole(loginManager);
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
if (loginManager.getInteger("org_id") != null) { if (loginManager.getInteger("org_id") != null) {
params.put("org_id", loginManager.getIntValue("org_id")); params.put("org_id", loginManager.getIntValue("org_id"));
@ -51,14 +50,14 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
manager.put("bdleader", ManagerRole.BD_LEADER.hasRole(role)); manager.put("bdleader", ManagerRole.BD_LEADER.hasRole(role));
manager.put("riskmanager", ManagerRole.RISK_MANAGER.hasRole(role)); manager.put("riskmanager", ManagerRole.RISK_MANAGER.hasRole(role));
manager.put("guest", ManagerRole.GUEST.hasRole(role)); manager.put("guest", ManagerRole.GUEST.hasRole(role));
manager.put("orgmanager", ManagerRole.ORG_MANAGER.hasRole(role));
} }
return managers; return managers;
} }
@Override @Override
public void saveManager(ManagerInfo manager, JSONObject loginManager) { public void saveManager(ManagerInfo manager, JSONObject loginManager) {
checkBdRole(loginManager); if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role"))) {
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()) { if (manager.isAdmin() || manager.isFinacial() || manager.isOperator() || manager.isServant() || manager.isSitemanager() || manager.isDeveloper()) {
throw new BadRequestException("Invalid Role"); throw new BadRequestException("Invalid Role");
} }
@ -73,13 +72,12 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override @Override
public void modify(String userId, ManagerInfo manager, JSONObject loginManager) { public void modify(String userId, ManagerInfo manager, JSONObject loginManager) {
checkBdRole(loginManager);
JSONObject managerFromDb = managerMapper.findById(userId); JSONObject managerFromDb = managerMapper.findById(userId);
if (managerFromDb == null) { if (managerFromDb == null) {
throw new NotFoundException("manager not exists or invalid"); throw new NotFoundException("manager not exists or invalid");
} }
JSONObject obj = manager.accountJson(false); JSONObject obj = manager.accountJson(false);
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))) { if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role"))) {
if (managerFromDb.getIntValue("org_id") != loginManager.getIntValue("org_id")) { if (managerFromDb.getIntValue("org_id") != loginManager.getIntValue("org_id")) {
throw new BadRequestException("You cannot modify accounts belong to other organizations"); throw new BadRequestException("You cannot modify accounts belong to other organizations");
} }
@ -94,9 +92,8 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override @Override
public void disable(String userId, JSONObject loginManager) { public void disable(String userId, JSONObject loginManager) {
checkBdRole(loginManager);
JSONObject manager = managerMapper.findById(userId); JSONObject manager = managerMapper.findById(userId);
if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))){ if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role"))){
if (manager.getIntValue("org_id") != loginManager.getIntValue("org_id")) { if (manager.getIntValue("org_id") != loginManager.getIntValue("org_id")) {
throw new BadRequestException("You cannot disable accounts belong to other organizations"); throw new BadRequestException("You cannot disable accounts belong to other organizations");
} }
@ -126,15 +123,4 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
return financialBDConfigMapper.getBdConfig(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,7 +32,10 @@ import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* account service for sign in * account service for sign in
@ -64,14 +67,11 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
@Cacheable(value = ":login:managers:", key = "''+#accountId") @Cacheable(value = ":login:managers:", key = "''+#accountId")
public JSONObject getManager(String accountId) { public JSONObject getManager(String accountId) {
JSONObject manager = managerMapper.findById(accountId); JSONObject manager = managerMapper.findById(accountId);
JSONObject org = null;
if (manager == null) { if (manager == null) {
throw new ForbiddenException("用户不存在或已禁用"); throw new ForbiddenException("用户不存在或已禁用");
} }
if (manager.getInteger("org_id") != null) { if (manager.getInteger("org_id") != null) {
org = orgMapper.findOne(manager.getIntValue("org_id")); manager.put("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<JSONObject> funcs = permissionManager.listUserFunctions(manager.getIntValue("role"));
List<String> funcIds = new ArrayList<>(); List<String> funcIds = new ArrayList<>();
@ -90,36 +90,12 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
modules.put(module, mod); 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_ids", funcIds);
manager.put("available_func_names", funcNames); manager.put("available_func_names", funcNames);
manager.put("modules", modules.values()); manager.put("modules", modules.values());
manager.put("module_names", modules.keySet()); manager.put("module_names", modules.keySet());
return manager; 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 @Override
@Cacheable(value = ":login:clients:", key = "''+#accountId") @Cacheable(value = ":login:clients:", key = "''+#accountId")

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.signin.web; 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.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.permission.manager.RequireManager;
@ -25,6 +26,8 @@ import java.util.Map;
public class ManagerAccountsController { public class ManagerAccountsController {
@Resource @Resource
private ManagerAccountsService managerAccountsService; private ManagerAccountsService managerAccountsService;
@Resource
private OrgManager orgManager;
// @RequestMapping(method = RequestMethod.GET) // @RequestMapping(method = RequestMethod.GET)
// @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER}) // @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER})
@ -33,14 +36,14 @@ public class ManagerAccountsController {
// } // }
@RequestMapping(method = RequestMethod.GET) @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) { public List<JSONObject> listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestParam Map<String, Object> map) {
loginManager.putAll(map); loginManager.putAll(map);
return managerAccountsService.listManagers(loginManager); return managerAccountsService.listManagers(loginManager);
} }
@RequestMapping(method = RequestMethod.POST) @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) { public void saveManager(@RequestBody @Valid ManagerInfo manager, Errors errors, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
managerAccountsService.saveManager(manager, loginManager); managerAccountsService.saveManager(manager, loginManager);
@ -48,19 +51,22 @@ public class ManagerAccountsController {
@ManagerMapping(value = "/roles/bd_user", method = RequestMethod.GET) @ManagerMapping(value = "/roles/bd_user", method = RequestMethod.GET)
public List<JSONObject> listBDUsers(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) { public List<JSONObject> listBDUsers(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
return managerAccountsService.listBDUsers(loginManager); JSONObject params = new JSONObject();
orgManager.checkOrg(loginManager,params);
return managerAccountsService.listBDUsers(params);
} }
@ManagerMapping(value = "/roles/org_bd_user", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.ACCOUNT_MANAGER}) @ManagerMapping(value = "/roles/org_bd_user", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.ACCOUNT_MANAGER})
public List<JSONObject> listOrgBDUsers(@RequestParam Map<String, Object> map) { public List<JSONObject> listOrgBDUsers(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager,@RequestParam Map<String, Object> map) {
return managerAccountsService.listBDUsers((JSONObject) JSON.toJSON(map)); JSONObject params = (JSONObject) JSON.toJSON(map);
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) { public void modify(@PathVariable String userId, @RequestBody ManagerInfo manager, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
managerAccountsService.modify(userId, manager, 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) { public void disableUser(@PathVariable String userId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
managerAccountsService.disable(userId, loginManager); managerAccountsService.disable(userId, loginManager);
} }

@ -20,6 +20,7 @@ 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.CustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean; import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
@ -121,7 +122,7 @@ public class TradeLogServiceImpl implements TradeLogService {
private ClientCustomersMapper clientCustomersMapper; private ClientCustomersMapper clientCustomersMapper;
@Resource @Resource
private OrgMapper orgMapper; private OrgManager orgManager;
// @Value("classpath:/jasper/trans_flow.jasper") // @Value("classpath:/jasper/trans_flow.jasper")
// @Value("classpath:/jasper/trans_flow_new.jasper") // @Value("classpath:/jasper/trans_flow_new.jasper")
@ -179,28 +180,7 @@ public class TradeLogServiceImpl implements TradeLogService {
params.put("bd_group_bd", query.getGroup_bd()); params.put("bd_group_bd", query.getGroup_bd());
} }
} }
if (manager.getInteger("org_id") != null) { orgManager.checkOrg(manager,params);
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"))); PageList<JSONObject> logs = orderMapper.listOrders(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject result = PageListUtils.buildPageListResult(logs);
JSONObject analysis = orderMapper.analysisOrders(params); JSONObject analysis = orderMapper.analysisOrders(params);
@ -208,6 +188,8 @@ public class TradeLogServiceImpl implements TradeLogService {
return result; return result;
} }
@Override @Override
public List<JSONObject> listOrderRefunds(String orderId, String timezone) { public List<JSONObject> listOrderRefunds(String orderId, String timezone) {
List<JSONObject> refunds = refundMapper.listOrderRefunds(orderId, new PageBounds(Order.formString("create_time.desc"))); List<JSONObject> refunds = refundMapper.listOrderRefunds(orderId, new PageBounds(Order.formString("create_time.desc")));

@ -85,6 +85,8 @@ app.mail.host=https://mailsupport.royalpay.com.au
mail.send.credentialCode=Fd1aRfdjc9 mail.send.credentialCode=Fd1aRfdjc9
apple.message.apns.password=F1b5*ChJPp73 apple.message.apns.password=F1b5*ChJPp73
android.message.secret=2b96d9bc6169c9554218aab1
android.message.appkey=3f33a10d0a7d4ac94d8f2431
spring.thymeleaf.mode=LEGACYHTML5 spring.thymeleaf.mode=LEGACYHTML5

@ -8,7 +8,9 @@
WHERE WHERE
create_time >= #{begin} AND create_time <= #{end} and is_valid=1 and (approve_result is null or approve_result !=0) create_time >= #{begin} AND create_time <= #{end} and is_valid=1 and (approve_result is null or approve_result !=0)
]]> ]]>
<if test="org_id!=null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</select> </select>
<select id="countNewClientsHistory" resultType="com.alibaba.fastjson.JSONObject"> <select id="countNewClientsHistory" resultType="com.alibaba.fastjson.JSONObject">
@ -25,7 +27,9 @@
<![CDATA[ <![CDATA[
where a.datelist>= #{begin} AND a.datelist< #{end} AND c.is_valid=1 where a.datelist>= #{begin} AND a.datelist< #{end} AND c.is_valid=1
]]> ]]>
<if test="org_id!=null">and c.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==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="bd_group!=null">and c.client_id in <if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -43,7 +47,9 @@
WHERE WHERE
create_time <= #{end} AND is_valid=1 and (approve_result is null or approve_result !=0) create_time <= #{end} AND is_valid=1 and (approve_result is null or approve_result !=0)
]]> ]]>
<if test="org_id!=null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</select> </select>
<select id="countTradedPartners" resultType="java.lang.Integer"> <select id="countTradedPartners" resultType="java.lang.Integer">
<![CDATA[ <![CDATA[
@ -52,7 +58,9 @@
INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL
WHERE o.create_time >= #{begin} AND o.create_time <= #{end} WHERE o.create_time >= #{begin} AND o.create_time <= #{end}
]]> ]]>
<if test="org_id!=null">and p.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and p.org_id=#{org_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>
</select> </select>
<select id="countTradePartnersHistory" resultType="com.alibaba.fastjson.JSONObject"> <select id="countTradePartnersHistory" resultType="com.alibaba.fastjson.JSONObject">
@ -62,7 +70,9 @@
INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL
WHERE o.create_time >= #{begin} AND o.create_time <= #{end} WHERE o.create_time >= #{begin} AND o.create_time <= #{end}
]]> ]]>
<if test="org_id!=null">and p.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and p.org_id=#{org_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="bd_group!=null">and p.client_id in <if test="bd_group!=null">and p.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -85,7 +95,9 @@
INNER JOIN pmt_orders o ON t.order_id = o.order_id INNER JOIN pmt_orders o ON t.order_id = o.order_id
WHERE o.create_time >= #{begin} AND o.create_time <= #{end} WHERE o.create_time >= #{begin} AND o.create_time <= #{end}
]]> ]]>
<if test="org_id!=null">and p.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and p.org_id=#{org_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="bd_group!=null">and p.client_id in <if test="bd_group!=null">and p.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -107,7 +119,9 @@
</if> </if>
<where> <where>
is_valid = 1 and industry &lt;'400' AND approve_result=1 is_valid = 1 and industry &lt;'400' AND approve_result=1
<if test="org_id!=null">and org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and c.client_id in <if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id

@ -177,7 +177,7 @@
<if test="trade_type!=null">and o.gateway in <if test="trade_type!=null">and o.gateway in
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach> <foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach>
</if> </if>
<if test="org_id!=null">and p.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if>
<if test="from!=null">and o.create_time &gt;= #{from}</if> <if test="from!=null">and o.create_time &gt;= #{from}</if>
<if test="to!=null">and o.create_time &lt; #{to}</if> <if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="date!=null">and date(o.create_time)=date(#{date})</if> <if test="date!=null">and date(o.create_time)=date(#{date})</if>
@ -359,11 +359,13 @@
and t.system_transaction_id =#{search_text} and t.system_transaction_id =#{search_text}
</if> </if>
</if> </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="order_id!=null">and o.order_id=#{order_id}</if> <if test="order_id!=null">and o.order_id=#{order_id}</if>
<if test="trade_type!=null">and o.gateway in <if test="trade_type!=null">and o.gateway in
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach> <foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach>
</if> </if>
<if test="org_id!=null">and p.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if>
<if test="from!=null">and o.create_time &gt;= #{from}</if> <if test="from!=null">and o.create_time &gt;= #{from}</if>
<if test="to!=null">and o.create_time &lt; #{to}</if> <if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="date!=null">and date(o.create_time)=date(#{date})</if> <if test="date!=null">and date(o.create_time)=date(#{date})</if>

@ -3,7 +3,7 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ManagerMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.system.ManagerMapper">
<select id="listByRole" resultType="com.alibaba.fastjson.JSONObject"> <select id="listByRole" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT manager_id,display_name,role,m.org_id,o.name org_name,m.wx_openid wx_openid FROM sys_managers m SELECT manager_id,display_name,role,m.org_id,o.name org_name,m.wx_openid wx_openid,o.parent_org_id FROM sys_managers m
LEFT JOIN sys_org o ON o.org_id=m.org_id LEFT JOIN sys_org o ON o.org_id=m.org_id
WHERE role & #{mask} >0 and m.is_valid=1 WHERE role & #{mask} >0 and m.is_valid=1
AND o.type = 0 AND o.type = 0

@ -31,6 +31,10 @@
</if> </if>
</select> </select>
<select id="listOrgAndChild" resultType="com.alibaba.fastjson.JSONObject">
select * FROM sys_org where is_valid=1 and type=0 and (org_id=#{org_id} or parent_org_id=#{org_id})
</select>
<!--<select id="getReferres" resultType="com.alibaba.fastjson.JSONObject">--> <!--<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--> <!--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--> <!--RIGHT JOIN sys_org o on o.org_id = m.org_id-->

@ -83,6 +83,9 @@
<div class="checkbox-inline"> <div class="checkbox-inline">
<label><input type="checkbox" ng-model="params.guest" name="params.guest">GUEST:观察员</label> <label><input type="checkbox" ng-model="params.guest" name="params.guest">GUEST:观察员</label>
</div> </div>
<div class="checkbox-inline">
<label><input type="checkbox" ng-model="params.orgmanager" name="params.orgmanager">ORG_MANAGER:代理商管理</label>
</div>
<div class="form-group"> <div class="form-group">
<label>Title</label> <label>Title</label>
<input ng-model="params.r_title" class="form-control" type="text" required/> <input ng-model="params.r_title" class="form-control" type="text" required/>

@ -33,6 +33,7 @@
<option value="1000000000">BD Leader</option> <option value="1000000000">BD Leader</option>
<option value="10000000000">Risk Manager</option> <option value="10000000000">Risk Manager</option>
<option value="100000000000">Guest</option> <option value="100000000000">Guest</option>
<option value="1000000000000">Org Manager</option>
</select> </select>
</div> </div>
<div class="form-group" ng-if="'1'|withRole"> <div class="form-group" ng-if="'1'|withRole">
@ -95,6 +96,7 @@
<i class="fa fa-male" title="BD Leader" ng-class="{'text-green':manager.bdleader,'text-gray':!manager.bdleader}"></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-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-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>
<td> <td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a> <a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>

@ -81,6 +81,9 @@
<label ng-if="('00001'|withRole)"> <label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.riskmanager" name="riskmanager">Risk Manager <input type="checkbox" ng-model="manager.riskmanager" name="riskmanager">Risk Manager
</label> </label>
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="orgmanager">Org Manager
</label>
</p> </p>
</div> </div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && !manager.sitemanager && orgs!=null"> <div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && !manager.sitemanager && orgs!=null">

@ -36,17 +36,17 @@
</div> </div>
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div> <div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
</div> </div>
<div class="form-group"> <div class="form-group" ng-class="{'has-error':accountForm.email.$invalid && accountForm.email.$dirty}">
<label class="control-label" for="email-input">Email</label> <label class="control-label" for="email-input">Email</label>
<input class="form-control" type="email" id="email-input" name="email" <input class="form-control" type="email" id="email-input" name="email"
ng-model="manager.email"> ng-model="manager.email">
</div> </div>
<div class="form-group"> <div class="form-group" ng-class="{'has-error':accountForm.phone.$invalid && accountForm.phone.$dirty}">
<label class="control-label" for="phone-input">Phone</label> <label class="control-label" for="phone-input">Phone</label>
<input class="form-control" type="text" id="phone-input" name="phone" <input class="form-control" type="text" id="phone-input" name="phone"
ng-model="manager.phone"> ng-model="manager.phone">
</div> </div>
<div class="form-group"> <div class="form-group" ng-class="{'has-error':accountForm.wechat.$invalid && accountForm.wechat.$dirty}">
<label class="control-label" for="wechat-input">WeChat Account</label> <label class="control-label" for="wechat-input">WeChat Account</label>
<input class="form-control" type="text" id="wechat-input" name="wechat" <input class="form-control" type="text" id="wechat-input" name="wechat"
ng-model="manager.wechat"> ng-model="manager.wechat">
@ -90,6 +90,9 @@
<label ng-if="('00001'|withRole)"> <label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.guest" name="guest">Guest <input type="checkbox" ng-model="manager.guest" name="guest">Guest
</label> </label>
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="guest">Org Manager
</label>
</p> </p>
</div> </div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs != null"> <div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs != null">

@ -192,6 +192,7 @@
<option value="1000000">Director</option> <option value="1000000">Director</option>
<option value="10000000">Site Manager</option> <option value="10000000">Site Manager</option>
<option value="100000000">Developer</option> <option value="100000000">Developer</option>
<option value="1000000000000">Org Manager</option>
</select> </select>
</div> </div>
</form> </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-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-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-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>
<td> <td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a> <a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>

@ -168,7 +168,8 @@
ng-click="disableOrg(org)" ng-if="(currentUser.org_id == null)||(org.parent_org_id == currentUser.org_id)">Disable</a> ng-click="disableOrg(org)" ng-if="(currentUser.org_id == null)||(org.parent_org_id == currentUser.org_id)">Disable</a>
<a role="button" class="text-bold text-primary" <a role="button" class="text-bold text-primary"
ui-sref=".detail_parent({orgId:org.org_id})" ng-if="org.org_id==currentUser.org_id">Detail</a> ui-sref=".detail_parent({orgId:org.org_id})" ng-if="org.org_id==currentUser.org_id"><i
class="fa fa-edit"></i> Edit</a>
</div> </div>
</td> </td>
</tr> </tr>

@ -67,6 +67,10 @@
<i class="fa fa-tripadvisor"></i> <i class="fa fa-tripadvisor"></i>
GUEST GUEST
</a> </a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('1000000000000')">
<i class="fa fa-user-plus"></i>
Org Manager
</a>
</div> </div>
</div> </div>
</div> </div>

@ -2519,5 +2519,32 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
return bdUsers; return bdUsers;
} }
}); });
app.filter('bdOrgSelect', function () {
return function (bdUsers, params) {
var org_id;
org_id = params.org_ids ||params.org_id || currentUser.org_id;
if (org_id) {
var bdUserByOrg = {};
var count = 0;
angular.forEach(bdUsers, function (bdUser) {
if(params.org_ids){
if (bdUser.org_id == org_id) {
bdUserByOrg[count] = bdUser;
count++;
}
}else {
if (bdUser.org_id == org_id || bdUser.parent_org_id == org_id) {
bdUserByOrg[count] = bdUser;
count++;
}
}
});
return bdUserByOrg;
}
return bdUsers;
}
});
return app; return app;
}); });

@ -148,7 +148,7 @@
</div> </div>
</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">Sub Organization</label>
<label class="control-label col-xs-4 col-sm-4" for="org-clild" ng-if="currentUser.org_id">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"> <div class="col-xs-6 col-sm-6">
@ -237,12 +237,12 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group col-sm-6" ng-if="!('100'|withRole)"> <div class="form-group col-sm-6" ng-if="!('100'|withRole) || (currentUser.org_id && !currentUser.parent_org_id)">
<label class="control-label col-xs-4 col-sm-4" for="bd-select">BD <label class="control-label col-xs-4 col-sm-4" for="bd-select">BD
User</label> User</label>
<div class="col-xs-6 col-sm-6"> <div class="col-xs-6 col-sm-6">
<select id="bd-select" class="form-control" ng-model="params.bd" <select id="bd-select" class="form-control" ng-model="params.bd"
ng-options="bd.manager_id as bd.display_name group by bd.org_name for bd in bdUserSource | bdOrg:params.org_id"> ng-options="bd.manager_id as bd.display_name group by bd.org_name for bd in bdUserSource | bdOrgSelect:params">
<option value="">All</option> <option value="">All</option>
</select> </select>
</div> </div>

Loading…
Cancel
Save