master
wangning 7 years ago
commit 63f9391f58

@ -150,8 +150,8 @@ public interface ClientManager {
List<JSONObject> listSubClients(int clientId);
// void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager);
// void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager);
void validateClients(int client_id, JSONObject params) throws Exception;
void updateClientBDUsers(JSONObject manager, String clientMoniker, JSONObject data) throws Exception;
@ -193,6 +193,8 @@ public interface ClientManager {
void setClientRetailPaySurCharge(String clientMoniker, boolean paySurcharge);
void setClientTaxInSurcharge(String clientMoniker, boolean taxInSurcharge);
List<JSONObject> listClientsForSettlement();
List<JSONObject> listClientsDetailsForSettlement();

@ -228,7 +228,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
if (manager!=null){
if (manager != null) {
checkClientOrg(manager, client);
}
client.put("show_all_permission", true);
@ -291,10 +291,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
private void checkClientOrg(JSONObject manager, JSONObject client) {
if (manager.getInteger("org_id")!=null){
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(client.getIntValue("org_id"))){
List<Integer> orgIds = orgs.stream().map(org -> org.getIntValue("org_id")).collect(Collectors.toList());
if (!orgIds.contains(client.getIntValue("org_id"))) {
throw new ForbiddenException("The org of client is not belong to you");
}
}
@ -313,11 +313,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public JSONObject listClients(JSONObject manager, PartnerQuery query) {
JSONObject params = query.toJsonParam();
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"));
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");
}
}
@ -331,15 +331,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
int orgId = manager.getIntValue("org_id");
if (orgId > 0) {
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);
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 {
} else {
params.put("org_id", params.getIntValue("org_ids"));
params.remove("org_ids");
}
@ -349,16 +349,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (bdConfig != null) {
params.put("bd_group", bdConfig.getString("bd_group"));
List<JSONObject> listGroupBds = financialBDConfigMapper.listGroupBds(bdConfig.getString("bd_group"));
List<String> bdUserId = listGroupBds.stream().map(groupBd->groupBd.getString("manager_id")).collect(Collectors.toList());
if(params.containsKey("bd_user")){
if(!bdUserId.contains(params.getString("bd_user"))){
List<String> bdUserId = listGroupBds.stream().map(groupBd -> groupBd.getString("manager_id")).collect(Collectors.toList());
if (params.containsKey("bd_user")) {
if (!bdUserId.contains(params.getString("bd_user"))) {
params.remove("bd_user");
}
}
if(params.containsKey("org_ids")){
if (params.containsKey("org_ids")) {
params.remove("org_ids");
}
if(params.containsKey("org_id")){
if (params.containsKey("org_id")) {
params.remove("org_id");
}
}
@ -390,18 +390,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return PageListUtils.buildPageListResult(partners);
}
private void orgIds(JSONObject params,int orgId){
private void orgIds(JSONObject params, int orgId) {
JSONObject param = new JSONObject();
param.put("parent_org_id",params.getString("org_id"));
param.put("type",0);
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 ){
if (childOrgs.size() > 0) {
for (JSONObject object : childOrgs) {
orgIds.add(object.getIntValue("org_id"));
}
orgIds.add(orgId);
params.put("org_ids",orgIds);
params.put("org_ids", orgIds);
params.remove("org_id");
}
}
@ -1206,21 +1207,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
config.put("active_time", DateFormatUtils.format(config.getDate("active_time"), "yyyy-MM-dd"));
config.put("expiry_time", DateFormatUtils.format(config.getDate("expiry_time"), "yyyy-MM-dd"));
checkAddRate(config,"Wechat", "wechat_rate_value",org,"min_wechat_rate");
checkAddRate(config,"Alipay", "alipay_rate_value",org,"min_alipay_rate");
checkAddRate(config,"AlipayOnline", "alipayonline_rate_value",org,"min_alipayonline_rate");
checkAddRate(config,"Bestpay", "bestpay_rate_value",org,"min_bestpay_rate");
checkAddRate(config,"jd", "jd_rate_value",org,"min_jd_rate");
checkAddRate(config, "Wechat", "wechat_rate_value", org, "min_wechat_rate");
checkAddRate(config, "Alipay", "alipay_rate_value", org, "min_alipay_rate");
checkAddRate(config, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate");
checkAddRate(config, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate");
checkAddRate(config, "jd", "jd_rate_value", org, "min_jd_rate");
configNewClientRate(config, clientId, "Wechat", "wechat_rate_value",org,"min_wechat_rate");
configNewClientRate(config, clientId, "Alipay", "alipay_rate_value",org,"min_alipay_rate");
configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value",org,"min_alipayonline_rate");
configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value",org,"min_bestpay_rate");
configNewClientRate(config, clientId, "jd", "jd_rate_value",org,"min_jd_rate");
configNewClientRate(config, clientId, "Wechat", "wechat_rate_value", org, "min_wechat_rate");
configNewClientRate(config, clientId, "Alipay", "alipay_rate_value", org, "min_alipay_rate");
configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate");
configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate");
configNewClientRate(config, clientId, "jd", "jd_rate_value", org, "min_jd_rate");
}
private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey,JSONObject org,String rateValueKey) {
private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey, JSONObject org, String rateValueKey) {
if (config.containsKey(rateKey)) {
JSONObject newConfig = new JSONObject();
newConfig.putAll(config);
@ -1249,11 +1250,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client);
JSONObject configJson = config.toJSON();
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
checkModifyRate(org,configJson,"Wechat","min_wechat_rate");
checkModifyRate(org,configJson,"Alipay","min_alipay_rate");
checkModifyRate(org,configJson,"AlipayOnline","min_alipayonline_rate");
checkModifyRate(org,configJson,"jd","min_jd_rate");
checkModifyRate(org,configJson,"Bestpay","min_bestpay_rate");
checkModifyRate(org, configJson, "Wechat", "min_wechat_rate");
checkModifyRate(org, configJson, "Alipay", "min_alipay_rate");
checkModifyRate(org, configJson, "AlipayOnline", "min_alipayonline_rate");
checkModifyRate(org, configJson, "jd", "min_jd_rate");
checkModifyRate(org, configJson, "Bestpay", "min_bestpay_rate");
configJson.put("client_rate_id", rateId);
configJson.put("manager_id", manager.getString("manager_id"));
configJson.put("manager_name", manager.getString("username"));
@ -1267,23 +1268,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
// clientMapper.updateCleanDays(clientId, config.getCleanDays());
}
private void checkModifyRate(JSONObject org,JSONObject configJson,String rateName,String rateValueKey){
if(configJson.getString("rate_name").equals(rateName)){
if(org.containsKey(rateValueKey)){
if(configJson.getDouble("rate_value").compareTo(org.getDouble(rateValueKey)) < 0){
throw new ForbiddenException("费率参数小于旗下商户最低"+rateName+"费率,请重新输入");
};
private void checkModifyRate(JSONObject org, JSONObject configJson, String rateName, String rateValueKey) {
if (configJson.getString("rate_name").equals(rateName)) {
if (org.containsKey(rateValueKey)) {
if (configJson.getDouble("rate_value").compareTo(org.getDouble(rateValueKey)) < 0) {
throw new ForbiddenException("费率参数小于旗下商户最低" + rateName + "费率,请重新输入");
}
;
}
}
}
private void checkAddRate(JSONObject config,String channel, String rateKey,JSONObject org,String rateValueKey){
if(config.containsKey(rateKey)){
if(org.containsKey(rateValueKey)){
if(config.getBigDecimal(rateKey).compareTo(org.getBigDecimal(rateValueKey)) < 0){
throw new ForbiddenException("费率参数小于旗下商户最低"+channel+"费率,请重新输入");
};
private void checkAddRate(JSONObject config, String channel, String rateKey, JSONObject org, String rateValueKey) {
if (config.containsKey(rateKey)) {
if (org.containsKey(rateValueKey)) {
if (config.getBigDecimal(rateKey).compareTo(org.getBigDecimal(rateValueKey)) < 0) {
throw new ForbiddenException("费率参数小于旗下商户最低" + channel + "费率,请重新输入");
}
;
}
}
}
@ -1465,7 +1470,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
checkClientOrg(manager,client);
checkClientOrg(manager, client);
JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id"));
params.put("is_valid", "1");
@ -2081,7 +2086,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("Master Merchant is not valid");
}
client.put("parent_client_id", master_client.getIntValue("client_id"));
}else {
} else {
client.put("parent_client_id", null);
}
clientMapper.update(client);
@ -2159,6 +2164,20 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clearClientCache(clientId);
}
@Override
public void setClientTaxInSurcharge(String clientMoniker, boolean taxInSurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
update.put("client_id", clientId);
update.put("tax_in_surcharge", taxInSurcharge);
clientMapper.update(update);
clearClientCache(clientId);
}
@Override
public List<JSONObject> listClientsForSettlement() {
return clientMapper.listClientsForSettlement();
@ -2806,7 +2825,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
private TemplateMessage initSendToComplianceGreenChannelTemplate(String loginUrl, String wxopenid, String templateId2, String bd_user_name,
JSONObject client) {
JSONObject client) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId2, loginUrl);
msg.put("first", bd_user_name + " 提交了新商户绿色通道申请,请审核", "#ff0000");
msg.put("keyword1", client.getString("client_moniker") + "申请绿色通道", "#0000ff");
@ -2965,28 +2984,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
List<JSONObject> applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
if(!applices.isEmpty()){
List<JSONObject> applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"), new PageBounds(Order.formString("create_time.desc")));
if (!applices.isEmpty()) {
return applices;
}else {
if(StringUtils.isNotEmpty(client.getString("sub_merchant_id")) && StringUtils.isNotEmpty(client.getString("merchant_id"))){
Element elem = wxPayClient.querySubMerchant(client.getString("merchant_id"),client.getString("sub_merchant_id"));
} else {
if (StringUtils.isNotEmpty(client.getString("sub_merchant_id")) && StringUtils.isNotEmpty(client.getString("merchant_id"))) {
Element elem = wxPayClient.querySubMerchant(client.getString("merchant_id"), client.getString("sub_merchant_id"));
JSONObject object = new JSONObject();
object.put("sub_merchant_id",elem.elementText("sub_mch_id_0"));
object.put("client_id",client.getInteger("client_id"));
object.put("merchant_name",elem.elementText("merchant_name_0"));
object.put("merchant_shortname",elem.elementText("merchant_shortname_0"));
object.put("office_phone",elem.elementText("office_phone_0"));
object.put("contact_name",elem.elementText("contact_name_0"));
object.put("contact_email",elem.elementText("contact_email_0"));
object.put("contact_phone",elem.elementText("contact_phone_0"));
object.put("business_category",elem.elementText("business_category_0"));
object.put("merchant_remark",elem.elementText("merchant_remark_0"));
object.put("website",elem.elementText("website_0"));
object.put("merchant_introduction",elem.elementText("merchant_introduction_0"));
object.put("merchant_id",client.getString("merchant_id"));
object.put("create_time",new Date());
object.put("operator",manager.getString("display_name"));
object.put("sub_merchant_id", elem.elementText("sub_mch_id_0"));
object.put("client_id", client.getInteger("client_id"));
object.put("merchant_name", elem.elementText("merchant_name_0"));
object.put("merchant_shortname", elem.elementText("merchant_shortname_0"));
object.put("office_phone", elem.elementText("office_phone_0"));
object.put("contact_name", elem.elementText("contact_name_0"));
object.put("contact_email", elem.elementText("contact_email_0"));
object.put("contact_phone", elem.elementText("contact_phone_0"));
object.put("business_category", elem.elementText("business_category_0"));
object.put("merchant_remark", elem.elementText("merchant_remark_0"));
object.put("website", elem.elementText("website_0"));
object.put("merchant_introduction", elem.elementText("merchant_introduction_0"));
object.put("merchant_id", client.getString("merchant_id"));
object.put("create_time", new Date());
object.put("operator", manager.getString("display_name"));
List<JSONObject> applyQuery = new ArrayList<>();
applyQuery.add(object);
return applyQuery;
@ -2994,9 +3013,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return null;
}
@Override
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager) {
public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
@ -3004,34 +3024,34 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client);
JSONObject params = subMerchantApply.insertObject();
SubMerchantInfo subMerchantInfo = JSONObject.toJavaObject(params,SubMerchantInfo.class);
params.put("merchant_id",subMerchantApply.getMerchant_id());
params.put("client_id",client.getString("client_id"));
params.put("create_time",new Date());
params.put("operator",manager.getString("display_name"));
Element elem = wxPayClient.subMerchantApplication(subMerchantApply.getMerchant_id(),subMerchantInfo);
SubMerchantInfo subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfo.class);
params.put("merchant_id", subMerchantApply.getMerchant_id());
params.put("client_id", client.getString("client_id"));
params.put("create_time", new Date());
params.put("operator", manager.getString("display_name"));
Element elem = wxPayClient.subMerchantApplication(subMerchantApply.getMerchant_id(), subMerchantInfo);
String sub_merchant_id = elem.elementText("sub_mch_id");
if(StringUtils.isNotEmpty(sub_merchant_id)){
params.put("sub_merchant_id",sub_merchant_id);
if (StringUtils.isNotEmpty(sub_merchant_id)) {
params.put("sub_merchant_id", sub_merchant_id);
sysWxMerchantApplyMapper.insertWxMerchantApply(params);
clearCacheSubMerchantIdApplices(clientMoniker);
}else {
} else {
throw new BadRequestException(elem.elementText("return_msg"));
}
return sub_merchant_id;
}
@Override
public List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager) {
public List<JSONObject> listMerchantIds(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
List<JSONObject> list = new ArrayList<>();
for (WeChatPayConfig.Merchant mch : WechatPayEnvironment.getEnv().getWechatMerchantConfigs()){
for (WeChatPayConfig.Merchant mch : WechatPayEnvironment.getEnv().getWechatMerchantConfigs()) {
JSONObject merchantIds = new JSONObject();
merchantIds.put("merchant_id",mch.getMerchantId());
merchantIds.put("merchant_id", mch.getMerchantId());
list.add(merchantIds);
}
return list;

@ -175,6 +175,11 @@ public class PartnerManageController {
clientManager.setClientRetailPaySurCharge(clientMoniker, config.getBooleanValue("retail_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/tax_in_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void setClientTaxPayer(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientTaxInSurcharge(clientMoniker, config.getBooleanValue("tax_in_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/credential_code", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void updateCredentialCode(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.refreshClientCredentialCode(manager, clientMoniker);

@ -184,7 +184,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.business_structures = businessStructuresMap.configs();
$scope.clean_days = angular.copy(clean_days_map);
$scope.bd_citys = angular.copy(bd_city_map);
$scope.params = {textType: 'all',org_name:'ALL'};
$scope.params = {textType: 'all', org_name: 'ALL'};
$scope.loadPartners = function (page) {
var params = angular.copy($scope.params);
@ -220,19 +220,19 @@ 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) {
$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.onOrgsSelect = function (selectedItem) {
$scope.params.org_id = selectedItem.org_id;
$scope.params.org_name = selectedItem.label;
$scope.loadPartners();
};
*/
/* $scope.chooseOrg = function (org) {
if (org == 'all') {
delete $scope.params.org_id;
@ -446,7 +446,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('partnerDetailCtrl', ['$scope', '$http', '$state', '$uibModal', '$rootScope', 'Upload', 'commonDialog', 'partner', function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner) {
$scope.init = {wechat_compliance: false,local_merchant:false};
$scope.init = {wechat_compliance: false, local_merchant: false};
$scope.partner = partner.data;
$scope.showDBUsers = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/bd_user').then(function (resp) {
@ -1334,6 +1334,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/skip_clearing', {skip_clearing: skipClearing}).then(function (resp) {
});
};
$scope.taxInSurcharge = function (taxInSurcharge) {
$http.put('/sys/partners/' + $scope.partner.tax_in_surcharge + '/tax_in_surcharge', {tax_in_surcharge: taxInSurcharge}).then(function (resp) {
})
};
$scope.settleHours = [{value: undefined, label: 'Default(24:00, GMT+10)'}];
for (var h = 24; h > 0; h--) {
$scope.settleHours.push({value: h, label: ('00' + h).substr(-2) + ':00, ' + $scope.partner.timezone});
@ -1809,8 +1814,8 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.gatewaySelected = function (arr) {
return $scope.params.gateway != null && $scope.params.gateway.filter(function (gateway) {
return arr.indexOf(gateway) >= 0
}).length > 0
return arr.indexOf(gateway) >= 0
}).length > 0
};
$scope.showRefundLog = function (orderId) {
@ -2043,7 +2048,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.chooseOrg = {};
$scope.chooseOrg.org_name = null;
if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) {
/* $scope.showOrg = 'Organization';*/
/* $scope.showOrg = 'Organization';*/
$http.get('/sys/orgs', {params: {}}).then(function (resp) {
$scope.orgs = resp.data;
});
@ -2051,22 +2056,22 @@ 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) {
$http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) {
$scope.orgs_child = resp.data;
})
};
/* $scope.chooseOrgFun = function (org) {
if (org == 'all') {
$scope.chooseOrg.org_name = null;
$scope.showOrg = 'All'
} else {
$scope.chooseOrg.org_name = org.name;
$scope.showOrg = org.name;
$scope.params.org_id = org.org_id;
$scope.loadOrgs();
}
};*/
/* $scope.chooseOrgFun = function (org) {
if (org == 'all') {
$scope.chooseOrg.org_name = null;
$scope.showOrg = 'All'
} else {
$scope.chooseOrg.org_name = org.name;
$scope.showOrg = org.name;
$scope.params.org_id = org.org_id;
$scope.loadOrgs();
}
};*/
function initBD() {
$http.get('/sys/partners/' + partner.client_moniker + '/bd_user/current').then(function (resp) {
@ -2076,12 +2081,12 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
if (m.manager_id == e.bd_id) {
m.choose = true;
m.proportion = e.proportion;
/* $scope.chooseOrgFun({org_id: m.org_id, name: m.org_name});*/
if(($scope.currentUser.role & parseInt('1000000000000', 2))>0){
/* $scope.chooseOrgFun({org_id: m.org_id, name: m.org_name});*/
if (($scope.currentUser.role & parseInt('1000000000000', 2)) > 0) {
$scope.params.org_ids = m.org_id;
$scope.params.org_id = m.org_id;
$scope.loadOrgs();
}else {
} else {
$scope.params.org_id = m.org_id;
$scope.loadOrgs();
}
@ -2576,7 +2581,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}
}]);
app.controller('subMerchantIdApplicaitonsCtrl', ['$scope', '$http', '$uibModal','$state','commonDialog', function ($scope, $http, $uibModal, $state,commonDialog) {
app.controller('subMerchantIdApplicaitonsCtrl', ['$scope', '$http', '$uibModal', '$state', 'commonDialog', function ($scope, $http, $uibModal, $state, commonDialog) {
$scope.loadSubMerchantInfos = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_sub_applices', {params: {}}).then(function (resp) {
$scope.subMerchantInfos = resp.data;
@ -2599,11 +2604,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
templateUrl: '/static/payment/partner/templates/apply_sub_merchant_id.html',
controller: 'applySubMerchantIdCtrl',
resolve: {
subMerchantInfo:function () {
subMerchantInfo: function () {
return $scope.partner;
},
merchantIds: ['$http', '$stateParams', function ($http) {
return $http.get('/sys/partners/'+ $scope.partner.client_moniker +'/get_merchant_ids');
return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids');
}]
}
}).result.then(function () {
@ -2612,7 +2617,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.loadSubMerchantInfos();
}]);
app.controller('applySubMerchantIdCtrl', ['$scope', '$http', '$uibModal','$state','subMerchantInfo', '$filter','merchantIds','commonDialog', function ($scope, $http, $uibModal, $state, subMerchantInfo,$filter,merchantIds,commonDialog) {
app.controller('applySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', '$filter', 'merchantIds', 'commonDialog', function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog) {
$scope.wxIndustries = angular.copy(wxMerchantIndustries);
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
$scope.merchantIds = merchantIds.data;
@ -2627,11 +2632,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
return;
}
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker+ '/sub_apply', $scope.subMerchantInfo).then(function (resp) {
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/sub_apply', $scope.subMerchantInfo).then(function (resp) {
$scope.apply_sub_merchant_id = resp.data;
$scope.$close();
if(subMerchantInfo.sub_merchant_id != null){
commonDialog.confirm({title:'Confirm',content:'已申请成功,是否确认使用'}).then(function () {
if (subMerchantInfo.sub_merchant_id != null) {
commonDialog.confirm({title: 'Confirm', content: '已申请成功,是否确认使用'}).then(function () {
$http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
@ -2643,7 +2648,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
})
}else {
} else {
$http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
@ -2681,7 +2686,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
var industry = '';
angular.forEach(wxMerchantIndustries, function (wxMerchant) {
if (wxMerchant.value == values) {
industry = wxMerchant.label;
industry = wxMerchant.label;
}
});
return industry;
@ -2690,17 +2695,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
app.filter('bdOrgSelect', function () {
return function (bdUsers, params) {
var org_id;
org_id = params.org_ids ||params.org_id || currentUser.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 (params.org_ids) {
if (bdUser.org_id == org_id) {
bdUserByOrg[count] = bdUser;
count++;
}
}else {
} else {
if (bdUser.org_id == org_id || bdUser.parent_org_id == org_id) {
bdUserByOrg[count] = bdUser;
count++;

@ -13,6 +13,13 @@
</a>
</h3>
<div class="form-horizontal">
<div class="form-group" ng-if="'modify_tax_in_surcharge'|withFunc">
<label class="col-sm-4">RoyalPay Pay GST</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="partner.tax_in_surcharge" bs-switch
switch-change="taxInSurcharge(partner.tax_in_surcharge)">
</div>
</div>
<div class="form-group" ng-if="'modify_skip_clear'|withFunc">
<label class="col-sm-4">Skip Clearing</label>
<div class="col-sm-6">

@ -100,9 +100,11 @@ $(function () {
dataCache.discounts = [];
dataCache.tax = surchargeData.tax;
dataCache.surcharge = surchargeData.surcharge;
$(window.coupons).each(function () {
price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons);
});
dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2,Decimal.ROUND_HALF_UP);
dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR);
var rate = 'CNY' == window.currency ? 1 : exchangeRate;
var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP);
@ -201,11 +203,8 @@ $(function () {
var bd = $('.weui_dialog_bd', dialog);
var currencySymbol = window.currency == 'AUD' ? '$' : '¥';
$('<p></p>').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd);
if (parseFloat(dataCache.surcharge) > 0) {
$('<p></p>').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.surcharge).appendTo(bd);
}
if (parseFloat(dataCache.tax) > 0) {
$('<p></p>').html('GST(10%):'+currencySymbol+dataCache.tax).appendTo(bd);
if (parseFloat(dataCache.customSurcharge) > 0) {
$('<p></p>').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.customSurcharge).appendTo(bd);
}
$(dataCache.discounts).each(function () {
$('<p></p>').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd);

@ -92,6 +92,7 @@ $(function () {
$(window.coupons).each(function () {
price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons);
});
dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2,Decimal.ROUND_HALF_UP);
dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR);
var rate = 'CNY' == window.currency ? 1 : exchangeRate;
var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP);
@ -190,11 +191,8 @@ $(function () {
var bd = $('.weui_dialog_bd', dialog);
var currencySymbol = window.currency == 'AUD' ? '$' : '¥';
$('<p></p>').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd);
if (parseFloat(dataCache.surcharge) > 0) {
$('<p></p>').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.surcharge).appendTo(bd);
}
if (parseFloat(dataCache.tax) > 0) {
$('<p></p>').html('GST(10%):'+currencySymbol+dataCache.tax).appendTo(bd);
if (parseFloat(dataCache.customSurcharge) > 0) {
$('<p></p>').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.customSurcharge).appendTo(bd);
}
$(dataCache.discounts).each(function () {
$('<p></p>').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd);

Loading…
Cancel
Save