Merge remote-tracking branch 'origin/develop' into develop

master
yixian 7 years ago
commit 9a40d2b726

@ -25,6 +25,10 @@ public interface OrgMapper {
List<JSONObject> listOrgs(@Param("type") int type, PageBounds order); List<JSONObject> listOrgs(@Param("type") int type, PageBounds order);
List<JSONObject> listOrgsWithParent(JSONObject params);
List<JSONObject> listOrgsWithChid(JSONObject params);
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void saveOrg(JSONObject org); void saveOrg(JSONObject org);
@ -41,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);
} }

@ -22,6 +22,7 @@ public class PartnerQuery {
private String short_name; private String short_name;
private String sub_merchant_id; private String sub_merchant_id;
private String org_id; private String org_id;
private String org_ids;
private Integer bd; private Integer bd;
private String business_structure; private String business_structure;
private String industry; private String industry;
@ -117,6 +118,9 @@ public class PartnerQuery {
if (org_id != null) { if (org_id != null) {
param.put("org_id", org_id); param.put("org_id", org_id);
} }
if (org_ids != null) {
param.put("org_ids", org_ids);
}
if (bd != null) { if (bd != null) {
param.put("bd_user", bd); param.put("bd_user", bd);
} }
@ -440,4 +444,12 @@ public class PartnerQuery {
public boolean isIs_valid() { public boolean isIs_valid() {
return is_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.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; 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.redpack.ActClientInvitationCodeMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper; import au.com.royalpay.payment.manage.merchants.beans.*;
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.merchants.core.ClientComplyValidator; import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService; 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.merchants.qrboard.QRBoardProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.ImageUtils; import au.com.royalpay.payment.tools.utils.*;
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.websocket.notify.PartnerPageEvent; 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.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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 com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; 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.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; 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.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; 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; 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")); 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) { 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) { if (org.getIntValue("type") == 1) {
params.put("referrer_id", org.getString("org_id")); params.put("referrer_id", org.getString("org_id"));
params.remove("org_id"); params.remove("org_id");
@ -336,7 +311,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
int orgId = manager.getIntValue("org_id"); int orgId = manager.getIntValue("org_id");
if (orgId > 0) { 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 tempSubMchId = sysConfigManager.getSysConfig().getString("temp_sub_mch_id");
String tempSubMchSource = sysConfigManager.getSysConfig().getString("temp_sub_mch_id_source"); String tempSubMchSource = sysConfigManager.getSysConfig().getString("temp_sub_mch_id_source");
@ -361,6 +347,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
return PageListUtils.buildPageListResult(partners); 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 @Override
public List<JSONObject> listPartners(JSONObject manager, PartnerQuery query) { public List<JSONObject> listPartners(JSONObject manager, PartnerQuery query) {

@ -10,7 +10,7 @@ import org.hibernate.validator.constraints.NotEmpty;
public class OrgInfo { public class OrgInfo {
@NotEmpty @NotEmpty
private String name; private String name;
private int type = 0; private String type;
private String logo; private String logo;
@NotEmpty @NotEmpty
private String location; private String location;
@ -32,6 +32,8 @@ public class OrgInfo {
private String search_text; private String search_text;
private int page = 1; private int page = 1;
private int limit = 10; private int limit = 10;
private String parent_org_id;
private String org_id;
public JSONObject toJsonParam() { public JSONObject toJsonParam() {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
@ -44,9 +46,15 @@ public class OrgInfo {
if (StringUtils.isNotBlank(search_text)) { if (StringUtils.isNotBlank(search_text)) {
param.put("search_text", search_text); param.put("search_text", search_text);
} }
if (StringUtils.isNotBlank(String.valueOf(type))){ if (type != null){
param.put("type", type); 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; return param;
} }
@ -126,11 +134,11 @@ public class OrgInfo {
this.rate_value = rate_value; this.rate_value = rate_value;
} }
public int getType() { public String getType() {
return type; return type;
} }
public void setType(int type) { public void setType(String type) {
this.type = type; this.type = type;
} }
@ -205,4 +213,20 @@ public class OrgInfo {
public void setLimit(int limit) { public void setLimit(int limit) {
this.limit = 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 { public interface OrgManager {
List<JSONObject> listOrgs(boolean detail); 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); JSONObject saveNewOrg(OrgInfo org);
@ -25,4 +27,5 @@ public interface OrgManager {
List<JSONObject> listAllOrg(); List<JSONObject> listAllOrg();
JSONObject checkOrg(JSONObject manager, JSONObject params);
} }

@ -3,16 +3,23 @@ package au.com.royalpay.payment.manage.organizations.core.impls;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper; 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.ForbiddenException;
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.JSONObject; 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.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.
@ -29,16 +36,47 @@ public class OrgManagerImpl implements OrgManager {
} }
@Override @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")); /* 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);
} }
@Override @Override
public JSONObject getOrgDetail(int orgId) { public JSONObject getOrgDetail(int orgId,JSONObject manager) {
checkBdRole(manager);
return orgMapper.findOne(orgId); return orgMapper.findOne(orgId);
} }
@ -86,4 +124,41 @@ public class OrgManagerImpl implements OrgManager {
return listAllOrgs; return listAllOrgs;
} }
private void checkBdRole(JSONObject manager){
if(ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))){
if(manager.getString("org_id") != null){
JSONObject org = orgMapper.findOne(manager.getIntValue("org_id"));
if(org != null && org.getIntValue("type") == 0 && org.getString("parent_org_id") != null){
throw new BadRequestException("Invalid Role");
}
}
}
}
@Override
public JSONObject checkOrg(JSONObject manager, JSONObject params){
if (params.getString("org_id")==null){
if (manager.getInteger("org_id")!=null){
List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id"));
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;
}
} }

@ -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.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.manage.permission.manager.ManagerMapping; 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.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -29,10 +31,16 @@ public class OrgManageController {
return orgManager.listOrgs(detail); 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) @RequestMapping(value = "/listsOrg", method = RequestMethod.GET)
@RequireManager @RequireManager
public JSONObject listsOrg(OrgInfo orgInfo) { public JSONObject listsOrg(OrgInfo orgInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.listAllOrgs(orgInfo); return orgManager.listAllOrgs(orgInfo,manager);
} }
@RequestMapping(value = "/list_all_Org", method = RequestMethod.GET) @RequestMapping(value = "/list_all_Org", method = RequestMethod.GET)
@ -41,15 +49,15 @@ public class OrgManageController {
return orgManager.listAllOrg(); 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) { 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) @ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN,ManagerRole.BD_USER})
public JSONObject getOrgDetail(@PathVariable int orgId) { public JSONObject getOrgDetail(@PathVariable int orgId,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.getOrgDetail(orgId); return orgManager.getOrgDetail(orgId,manager);
} }
@ManagerMapping(value = "/{orgId}", method = RequestMethod.PUT) @ManagerMapping(value = "/{orgId}", method = RequestMethod.PUT)
@ -58,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}) @ManagerMapping(value = "/{orgId}/enable_change_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN,ManagerRole.BD_USER})
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);

@ -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.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; 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.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo; import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService; import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
@ -22,11 +23,15 @@ import java.util.List;
public class ManagerAccountServiceImpl implements ManagerAccountsService { public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Resource @Resource
private ManagerMapper managerMapper; private ManagerMapper managerMapper;
@Resource
private OrgMapper orgMapper;
@Resource @Resource
private FinancialBDConfigMapper financialBDConfigMapper; private FinancialBDConfigMapper financialBDConfigMapper;
@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"));
@ -52,7 +57,8 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
@Override @Override
public void saveManager(ManagerInfo manager, JSONObject loginManager) { 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()) { if (manager.isAdmin() || manager.isFinacial() || manager.isOperator() || manager.isServant() || manager.isSitemanager() || manager.isDeveloper()) {
throw new BadRequestException("Invalid Role"); throw new BadRequestException("Invalid Role");
} }
@ -67,12 +73,13 @@ 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"))) { if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.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");
} }
@ -87,8 +94,9 @@ 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"))) { if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.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");
} }
@ -117,4 +125,16 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
public JSONObject getBDConfig(String bd_id){ public JSONObject getBDConfig(String bd_id){
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,10 +32,7 @@ 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.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* account service for sign in * account service for sign in
@ -67,11 +64,14 @@ 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) {
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<JSONObject> funcs = permissionManager.listUserFunctions(manager.getIntValue("role"));
List<String> funcIds = new ArrayList<>(); List<String> funcIds = new ArrayList<>();
@ -90,12 +90,36 @@ 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")

@ -33,14 +33,14 @@ public class ManagerAccountsController {
// } // }
@RequestMapping(method = RequestMethod.GET) @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) { 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}) @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) { 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);
@ -55,12 +55,12 @@ public class ManagerAccountsController {
return managerAccountsService.listBDUsers((JSONObject) JSON.toJSON(map)); 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) { 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}) @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) { public void disableUser(@PathVariable String userId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
managerAccountsService.disable(userId, loginManager); managerAccountsService.disable(userId, loginManager);
} }

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

@ -18,7 +18,9 @@ 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.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper; 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.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;
@ -119,6 +121,9 @@ public class TradeLogServiceImpl implements TradeLogService {
@Resource @Resource
private ClientCustomersMapper clientCustomersMapper; private ClientCustomersMapper clientCustomersMapper;
@Resource
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")
@Value("classpath:/jasper/partner_invoice.jasper") @Value("classpath:/jasper/partner_invoice.jasper")
@ -175,9 +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);
params.put("org_id", manager.getIntValue("org_id"));
}
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);
@ -185,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")));

@ -172,10 +172,12 @@
</if> </if>
</if> </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="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 <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>

@ -150,6 +150,8 @@
</if> </if>
</if> </if>
<if test="org_id!=null">and c.org_id=#{org_id}</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="referrer_id!=null">and c.referrer_id=#{referrer_id}</if>
<if test="is_valid">and c.is_valid=1</if> <if test="is_valid">and c.is_valid=1</if>
</where> </where>

@ -8,6 +8,33 @@
</if> </if>
</select> </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="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-->
@ -37,6 +64,13 @@
<if test="name!=null"> <if test="name!=null">
and org.name=#{name} and org.name=#{name}
</if> </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> </where>
</select> </select>
</mapper> </mapper>

@ -20,9 +20,9 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}; };
if($filter('withRole')('1')){ if($filter('withRole')('1')){
$scope.listOrgs = function () { $scope.listOrgs = function () {
$http.get('/sys/orgs',{params:{detail:true}}).then(function (resp) { $http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) {
$scope.orgs = resp.data; $scope.orgs = resp.data;
}) });
}; };
$scope.listOrgs(); $scope.listOrgs();
} }

@ -36,11 +36,17 @@
</select> </select>
</div> </div>
<div class="form-group" ng-if="'1'|withRole"> <div class="form-group" ng-if="'1'|withRole">
<select id="org-select" class="form-control" ng-model="search.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs">
<option value="">All Organizations</option>
</select>
</div>
<!--<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="org-select">Organizations</label> <label class="control-label" for="org-select">Organizations</label>
<select class="form-control" id="org-select" ng-model="search.org_id" ng-options="o.org_id as o.name for o in orgs"> <select class="form-control" id="org-select" ng-model="search.org_id" ng-options="o.org_id as o.name for o in orgs">
<option value="">All</option> <option value="">All</option>
</select> </select>
</div> </div>-->
</form> </form>
<div class="navbar-form navbar-right"> <div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()"> <button class="btn btn-success" type="button" ng-click="newManager()">

@ -36,22 +36,22 @@
</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">
</div> </div>
<div class="form-group"> <div class="form-group" ng-if="!currentUser.org_id">
<label class="control-label">Roles</label> <label class="control-label">Roles</label>
<p class="checkbox checkbox-inline"> <p class="checkbox checkbox-inline">
<label ng-if="('00001'|withRole)"> <label ng-if="('00001'|withRole)">

@ -26,6 +26,15 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
return $http.get('/sys/orgs/' + $stateParams.orgId); return $http.get('/sys/orgs/' + $stateParams.orgId);
}] }]
} }
}).state('organizations.detail_parent', {
url: '/{orgId}/detail_parent',
templateUrl: '/static/config/organizations/templates/org_detail_parent.html',
controller: 'orgDetailParentCtrl',
resolve: {
org: ['$http', '$stateParams', function ($http, $stateParams) {
return $http.get('/sys/orgs/' + $stateParams.orgId);
}]
}
}).state('organizations.new', { }).state('organizations.new', {
url: '/new_org', url: '/new_org',
templateUrl: '/static/config/organizations/templates/new_org.html', templateUrl: '/static/config/organizations/templates/new_org.html',
@ -33,17 +42,26 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}) })
}]); }]);
app.controller('orgsCtrl', ['$scope', '$http','commonDialog', function ($scope, $http,commonDialog ) { 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.pagination = {};
$scope.types = angular.copy(types); $scope.types = angular.copy(types);
$scope.listOrgs = function (page) { $scope.listOrgs = function (page) {
var params = angular.copy( $scope.params); var params = angular.copy( $scope.params);
params.page = page || $scope.pagination.page || 1; params.page = page || $scope.pagination.page || 1;
$http.get('/sys/orgs/listsOrg',{params:params}).then(function (resp) { $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; $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.disableOrg = function (org) {
$scope.org =angular.copy(org); $scope.org =angular.copy(org);
$scope.org.is_valid = 0; $scope.org.is_valid = 0;
@ -63,6 +81,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) { app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal','commonDialog', 'org', function ($scope, $http, $state, Upload,$uibModal,commonDialog, org) {
$scope.types = angular.copy(types); $scope.types = angular.copy(types);
$scope.org = angular.copy(org.data); $scope.org = angular.copy(org.data);
if ($scope.currentUser.org_id != null) {
$scope.org.type = 0;
}
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file == null) { if (file == null) {
return; return;
@ -154,6 +175,103 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}) })
} }
}]); }]);
app.controller('orgDetailParentCtrl', ['$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;
}
$scope.logoProgress = {value: 0};
Upload.upload({
url: '/attachment/files',
data: {file: file}
}).then(function (resp) {
delete $scope.logoProgress;
$scope.org.logo = resp.data.url;
}, function (resp) {
delete $scope.logoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
};
$scope.update = function (form) {
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
$http.put('/sys/orgs/' + $scope.org.org_id, $scope.org).then(function () {
commonDialog.alert({title: 'Succeed', content: 'Organization update succeeded', type: 'success'});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
};
/*
$scope.toggleRateEditable = function () {
if($scope.org.rate_editable==org.data.rate_editable){
return;
}
$http.put('/sys/orgs/'+$scope.org.org_id+'/enable_change_rate',{enabled:$scope.org.rate_editable}).then(function () {
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
};
$scope.search = {role:'1111111'};
$scope.listManagers = function () {
$http.get('/sys/manager_accounts',{params:{org_id:$scope.org.org_id}}).then(function (resp) {
$scope.managers = resp.data;
})
};
$scope.listManagers();
$scope.modifyManager = function (manager) {
$uibModal.open({
templateUrl: '/static/config/managers/templates/modify.html',
controller: 'modifyManagerCtrl',
resolve: {
manager: function () {
return angular.copy(manager);
}
}
}).result.then(function () {
$scope.listManagers();
})
};
$scope.disableManager = function (manager) {
commonDialog.confirm({
title: 'Confirm!',
content: 'You are setting manager ' + manager.display_name + ' disabled.Are you sure?'
}).then(function () {
$http.delete('/sys/manager_accounts/' + manager.manager_id).then(function () {
$scope.listManagers();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
})
};
$scope.newManager = function () {
$uibModal.open({
templateUrl: '/static/config/managers/templates/new_manager.html',
controller: 'newManagerCtrl',
resolve: {
org: angular.copy($scope.org)
}
}).result.then(function () {
$scope.listManagers();
})
}*/
}]);
app.controller('newOrgCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', function ($scope, $http, $state, Upload, commonDialog) { app.controller('newOrgCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', function ($scope, $http, $state, Upload, commonDialog) {
$scope.types = angular.copy(types); $scope.types = angular.copy(types);
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
@ -183,6 +301,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}); });
return; 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) { $http.post('/sys/orgs', $scope.org).then(function (resp) {
commonDialog.alert({ commonDialog.alert({
title: 'Succeed', title: 'Succeed',
@ -226,6 +348,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}); });
return; return;
} }
if(currentUser.org_id != null && !currentUser.parent_org_id){
$scope.manager.bd=true;
}
$http.post('/sys/manager_accounts', $scope.manager).then(function () { $http.post('/sys/manager_accounts', $scope.manager).then(function () {
$scope.$close(); $scope.$close();
}, function (resp) { }, function (resp) {

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

@ -0,0 +1,255 @@
<style>
.form-control-float {
float: left;
width: 93%; !important;
}
.form-control-span{
height: 34px;
}
</style>
<section class="content-header">
<h1 ng-bind="org.name"></h1>
<ol class="breadcrumb">
<li><i class="fa fa-users"></i> Basic Config</li>
<li>
<a ui-sref="^" ui-sref-opts="{reload:true}">Organizations</a>
</li>
<li class="active" ng-bind="org.name"></li>
</ol>
</section>
<section class="content">
<div class="box box-warning">
<div class="box-body">
<uib-tabset>
<uib-tab heading="Basic Info">
<form class="form-horizontal margin-top" name="org_form" novalidate>
<div class="panel">
<div class="form-group" ng-class="{'has-error':org_form.name.$invalid && org_form.name.$dirty}">
<label class="control-label col-sm-2" for="org_name_input">Name *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.name" id="org_name_input" name="name" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Logo</label>
<div class="col-sm-8">
<p class="form-control-static">
<button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB">
<i class="fa fa-upload"></i> Upload
</button>
<uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar>
<img ng-src="{{org.logo}}" class="col-sm-3" ng-if="org.logo">
</p>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.location.$invalid && org_form.location.$dirty}">
<label class="control-label col-sm-2" for="org_location_input">Location *</label>
<div class="col-sm-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}"
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">-->
<!--<option value="0">代理人</option>-->
<!--<option value="1">推荐人</option>-->
<!--</select>-->
<select class="form-control" name="type" required ng-model="org.type"
id="org_type_input"
ng-options="type.value as type.label for type in types">
<!--<option value="">Please Choose</option>-->
</select>
</div>
</div>
<div ng-if="org.type == 1">
<div class="form-group" ng-class="{'has-error':org_form.rate_value.$invalid && org_form.rate_value.$dirty}">
<label class="control-label col-sm-2" for="rate_value_input">Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.rate_value" id="rate_value_input" name="rate_value" max="100">
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
</div>
<div ng-if="org.type == 0">
<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>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.alipay_rate_value" id="alipay_rate_value_input" name="alipay_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.wechat_rate_value.$invalid && org_form.wechat_rate_value.$dirty}">
<label class="control-label col-sm-2" for="wechat_rate_value_input">Wechat Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.wechat_rate_value" id="wechat_rate_value_input" name="wechat_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.bestpay_rate_value.$invalid && org_form.bestpay_rate_value.$dirty}">
<label class="control-label col-sm-2" for="bestpay_rate_value_input">Bestpay Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.bestpay_rate_value" id="bestpay_rate_value_input" name="bestpay_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.jd_rate_value.$invalid && org_form.jd_rate_value.$dirty}">
<label class="control-label col-sm-2" for="jd_rate_value_input">JD Pay Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.jd_rate_value" id="jd_rate_value_input" name="jd_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.alipayonline_rate_value.$invalid && org_form.alipayonline_rate_value.$dirty}">
<label class="control-label col-sm-2" for="alipayonline_rate_value_input">AlipayOnline Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.alipayonline_rate_value" id="alipayonline_rate_value_input" name="alipayonline_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_person.$invalid && org_form.contact_person.$dirty}">
<label class="control-label col-sm-2" for="org_contact_person_input">Contact Person *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_person" id="org_contact_person_input" name="contact_person" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_phone.$invalid && org_form.contact_phone.$dirty}">
<label class="control-label col-sm-2" for="org_contact_phone_input">Phone *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_phone" id="org_contact_phone_input" name="contact_phone" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_mail.$invalid && org_form.contact_mail.$dirty}">
<label class="control-label col-sm-2" for="org_contact_mail_input">Mail *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_mail" id="org_contact_mail_input" name="contact_mail" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="commission_checkbox">Enable Commission</label>
<div class="col-sm-8">
<input id="commission_checkbox" type="checkbox" class="checkbox-inline checkbox" ng-model="org.commission" readonly
onclick="return false">
</div>
</div>
<div class="form-group"
ng-class="{'has-error':org_form.remark.$invalid && org_form.remark.$dirty}">
<label class="control-label col-sm-2" for="remark-input">Remark</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="org.remark" name="remark"
id="remark-input" maxlength="500"></textarea>
</div>
</div>
</div>
<div class="btn-group margin-bottom margin-top">
<button class="btn btn-success" type="button" ng-click="update(org_form)">Save
</button>
<a class="btn btn-danger" role="button" ui-sref="^" ui-sref-opts="{reload:true}">Back</a>
</div>
<!--<button class="btn btn-success col-sm-offset-2" ng-click="update()"><i class="fa fa-save"></i> Update</button>-->
</form>
</uib-tab>
<!-- <uib-tab heading="Permission" ng-if="org.type == 0">
<form class="form-horizontal margin-top" name="org_permission_form">
<div class="form-group">
<label class="col-xs-4 col-sm-2 control-label">Client Rate Editable</label>
<div class="col-xs-8 col-sm-8">
<input type="checkbox" ng-model="org.rate_editable" bs-switch switch-change="toggleRateEditable()">
</div>
</div>
</form>
</uib-tab>-->
</uib-tabset>
</div>
</div>
<!-- <div class="box-solid" ng-if="org.type == 0">
<div class="box box-warning">
<div class="box-header">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<label class="control-label" for="username-filter-input">Username</label>
<input type="text" class="form-control" ng-model="search.username" placeholder="Username" id="username-filter-input">
</div>
<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="role-filter-select">Role</label>
<select class="form-control" id="role-filter-select" ng-model="search.role">
<option value="1111111">All</option>
<option value="1">Administrator</option>
<option value="10">Compliance</option>
<option value="100">BD User</option>
<option value="1000">Accountant</option>
<option value="10000">Service</option>
<option value="100000">Account Manager</option>
<option value="1000000">Director</option>
<option value="10000000">Site Manager</option>
<option value="100000000">Developer</option>
</select>
</div>
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
<i class="fa fa-plus"></i> New Manager Account
</button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-body">
<div class="row">
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Display Name</th>
<th>Wechat</th>
<th>Create Time</th>
<th>Email</th>
<th>Roles</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="manager in managers|managersFilter:search">
<td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
<td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="manager.email"></td>
<td>
<i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i>
<i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i>
<i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i>
<i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i>
<i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i>
<i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i>
<i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i>
<i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i>
<i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i>
</td>
<td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>
|
<a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>-->
</section>

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

@ -122,7 +122,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) {
$scope.analysisClients(); $scope.analysisClients();
} }
$scope.pagination = {}; $scope.pagination = {};
$scope.industries = industryMap.configs(); $scope.industries = industryMap.configs();
$scope.states = stateMap.configs(); $scope.states = stateMap.configs();
@ -131,7 +130,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.business_structures = businessStructuresMap.configs(); $scope.business_structures = businessStructuresMap.configs();
$scope.clean_days = angular.copy(clean_days_map); $scope.clean_days = angular.copy(clean_days_map);
$scope.bd_citys = angular.copy(bd_city_map); $scope.bd_citys = angular.copy(bd_city_map);
$scope.params = {textType: 'all'}; $scope.params = {textType: 'all',org_name:'ALL'};
$scope.loadPartners = function (page) { $scope.loadPartners = function (page) {
var params = angular.copy($scope.params); 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) { /* $scope.chooseOrg = function (org) {
if (org == 'all') { if (org == 'all') {
delete $scope.params.org_id; delete $scope.params.org_id;

@ -142,11 +142,34 @@
<div class="col-xs-6 col-sm-6"> <div class="col-xs-6 col-sm-6">
<select id="org-select" class="form-control" ng-model="params.org_id" <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-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> <option value="">All</option>
</select> </select>
</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)">
<label class="control-label col-xs-4 col-sm-4" for="org-clild" ng-if="!currentUser.org_id">Sub Organization</label>
<label class="control-label col-xs-4 col-sm-4" for="org-clild" ng-if="currentUser.org_id">Organization</label>
<div class="col-xs-6 col-sm-6">
<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"> <!-- <div class="form-group col-sm-6" ng-if="orgs">
<label class="control-label col-xs-4 col-sm-4">Organization</label> <label class="control-label col-xs-4 col-sm-4">Organization</label>
<div class="col-xs-6"> <div class="col-xs-6">
@ -313,7 +336,7 @@
</div> </div>
</div> </div>
<!--status--> <!--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> <label class="control-label col-xs-4 col-sm-2">Status</label>
<!--<div class="col-xs-8 col-sm-4">--> <!--<div class="col-xs-8 col-sm-4">-->
<span class="col-xs-8 col-sm-10"> <span class="col-xs-8 col-sm-10">

@ -56,6 +56,16 @@
<input class="form-control" placeholder="Keyword" ng-enter="loadTradeLogs(1)" <input class="form-control" placeholder="Keyword" ng-enter="loadTradeLogs(1)"
ng-model="params.searchText"> ng-model="params.searchText">
</div> </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>
<div class="form-group col-xs-12"> <div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label> <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', app.controller('globalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService',
function ($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.pagination = {};
$scope.today = new Date(); $scope.today = new Date();
@ -76,6 +76,14 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.params.datefrom = monthBegin; $scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1); $scope.loadTradeLogs(1);
}; };
$scope.loadOrgs = function () {
$http.get('/sys/orgs/orgChild').then(function (resp) {
$scope.orgs = resp.data;
})
};
$scope.loadOrgs();
$scope.loadTradeLogs = function (page) { $scope.loadTradeLogs = function (page) {
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
if (params.datefrom) { if (params.datefrom) {

@ -1,6 +1,6 @@
package au.com.royalpay.payment.manage.apps.core.impls; package au.com.royalpay.payment.manage.apps.core.impls;
import au.com.royalpay.payment.manage.apps.core.CustomerImpression; import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -18,7 +18,7 @@ import javax.annotation.Resource;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
public class CustomerImpressionImplTest { public class CustomerImpressionImplTest {
@Resource @Resource
private CustomerImpression customerImpression; private CustomerImpressionService customerImpression;
@Test @Test
public void generate() throws Exception { public void generate() throws Exception {
customerImpression.generate(9); customerImpression.generate(9);

Loading…
Cancel
Save