gst in surcharge config

master
yixian 7 years ago
parent c71e629188
commit 138820f1bd

@ -150,8 +150,8 @@ public interface ClientManager {
List<JSONObject> listSubClients(int clientId); 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 validateClients(int client_id, JSONObject params) throws Exception;
void updateClientBDUsers(JSONObject manager, String clientMoniker, JSONObject data) 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 setClientRetailPaySurCharge(String clientMoniker, boolean paySurcharge);
void setClientTaxInSurcharge(String clientMoniker, boolean taxInSurcharge);
List<JSONObject> listClientsForSettlement(); List<JSONObject> listClientsForSettlement();
List<JSONObject> listClientsDetailsForSettlement(); List<JSONObject> listClientsDetailsForSettlement();

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

@ -175,6 +175,11 @@ public class PartnerManageController {
clientManager.setClientRetailPaySurCharge(clientMoniker, config.getBooleanValue("retail_surcharge")); clientManager.setClientRetailPaySurCharge(clientMoniker, config.getBooleanValue("retail_surcharge"));
} }
@ManagerMapping(value = "/{clientMoniker}/tax_in_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
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}) @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) { public void updateCredentialCode(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.refreshClientCredentialCode(manager, clientMoniker); clientManager.refreshClientCredentialCode(manager, clientMoniker);

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

@ -13,6 +13,13 @@
</a> </a>
</h3> </h3>
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group" ng-if="'modify_tax_in_surcharge'|withFunc">
<label class="col-sm-4">Skip Clearing</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"> <div class="form-group" ng-if="'modify_skip_clear'|withFunc">
<label class="col-sm-4">Skip Clearing</label> <label class="col-sm-4">Skip Clearing</label>
<div class="col-sm-6"> <div class="col-sm-6">

Loading…
Cancel
Save