update merchant

master
luoyang 6 years ago
parent 8eb861edf3
commit 1987cc09f8

@ -0,0 +1,26 @@
package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by yangluo on 2017-03-14.
*/
@AutoMapper(tablename = "sys_rpay_merchant_apply",pkName = "merchant_app_id")
public interface SysRpayMerchantApplyMapper {
@AutoSql(type = SqlType.SELECT)
List<JSONObject> listRpayMerchantApplices(@Param("client_id") int client_id, PageBounds pageBounds);
@AutoSql(type = SqlType.INSERT)
void insertRpayMerchantApply(JSONObject params);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> selectByShortName(@Param("client_id") int client_id,@Param("merchant_shortname") String shortName);
}

@ -60,6 +60,9 @@ public interface ClientManager {
@Transactional
void updateClientPaymentConfig(JSONObject manager, String clientMoniker, JSONObject subMerchantInfo);
@Transactional
void updateClientRpayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject rpaySubMerchantInfo);
@Transactional
void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo);
@ -296,6 +299,8 @@ public interface ClientManager {
List<JSONObject> listSubMerchantIdApplys(JSONObject manager, String clientMoniker);
List<JSONObject> listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker);
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager);
List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager);

@ -25,24 +25,7 @@ import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper;
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.risk.RiskAttentionMerchantsMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
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.ClientsContractMapper;
import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper;
import au.com.royalpay.payment.manage.mappers.system.MailSendMapper;
import au.com.royalpay.payment.manage.mappers.system.MailUnsubMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerModuleMapper;
import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
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;
@ -262,6 +245,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private SysWxMerchantApplyMapper sysWxMerchantApplyMapper;
@Resource
private SysRpayMerchantApplyMapper sysRpayMerchantApplyMapper;
@Resource
private SpringTemplateEngine thymeleaf;
@Resource
private DeviceManager deviceManager;
@ -770,6 +755,40 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void updateClientRpayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject rpaySubMerchantInfo) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
String originSubMerchantId = client.getString("rpay_enterprise_id");
update.put("client_id", clientId);
String subMerchantId = rpaySubMerchantInfo.getString("rpay_enterprise_id");
update.put("rpay_enterprise_id", subMerchantId);
try {
recordSubMerchantLog(client, rpaySubMerchantInfo, manager);
} catch (Exception e) {
logger.error("记录log_client_sub_merchant_id失败", e);
}
clientMapper.update(update);
List<JSONObject> children = clientMapper.listChildClients(clientId);
for (JSONObject child : children) {
if (Objects.equals(child.getString("rpay_enterprise_id"), originSubMerchantId)) {
update.put("client_id", child.getIntValue("client_id"));
try {
recordSubMerchantLog(child, rpaySubMerchantInfo, manager);
} catch (Exception e) {
logger.error("记录log_client_sub_merchant_id失败", e);
}
clientMapper.update(update);
}
}
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -3513,6 +3532,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return null;
}
@Override
public List<JSONObject> listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
List<JSONObject> applices = sysRpayMerchantApplyMapper.listRpayMerchantApplices(client.getInteger("client_id"),
new PageBounds(Order.formString("create_time.desc")));
if (!applices.isEmpty()) {
return applices;
}
return null;
}
@Override
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) {
@ -3548,22 +3582,30 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
checkOrgPermission(manager, client);
SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(client, SubRpayMerchantInfo.class);
subRpayMerchantInfo.CheckEmpty();
rpayApi.registerMerchant(client.getIntValue("client_id"), subRpayMerchantInfo);
logger.debug("访问成功,返回的信息是: " );
// String sub_merchant_id = elem.elementText("sub_mch_id");
/* if (StringUtils.isNotEmpty(sub_merchant_id)) {
List<JSONObject> selectByshortName = sysRpayMerchantApplyMapper.selectByShortName(client.getIntValue("client_id"),client.getString("short_name"));
if (selectByshortName.size()>0) {
throw new BadRequestException("请修改【" + clientMoniker + "】的Company shortName信息请避免和Rpay+商务号列表内的Company Short Name重复");
}
} else {
SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(client, SubRpayMerchantInfo.class);
subRpayMerchantInfo.CheckEmpty();
JSONObject rpayMerchantInfo = rpayApi.registerMerchant(client.getIntValue("client_id"), subRpayMerchantInfo);
if (rpayMerchantInfo != null) {
JSONObject merchantApply = new JSONObject();
merchantApply.put("merchant_id", rpayMerchantInfo.getString("rpay_order_id"));
merchantApply.put("client_id", client.getString("client_id"));
merchantApply.put("create_time", new Date());
merchantApply.put("operator", manager.getString("display_name"));
merchantApply.put("sub_merchant_id", rpayMerchantInfo.getString("merchantId"));
merchantApply.put("business_category", client.getString("royalpayindustry"));
merchantApply.put("merchant_shortname", client.getString("short_name"));
sysRpayMerchantApplyMapper.insertRpayMerchantApply(merchantApply);
}else {
throw new BadRequestException("请求失败");
}*/
}
return null;
}

@ -155,6 +155,11 @@ public class PartnerManageController {
clientManager.updateClientPaymentConfig(manager, clientMoniker, subMerchantInfo);
}
@ManagerMapping(value = "/{clientMoniker}/rpay_payment_config", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void updatePartnerRpayPaymentConfig(@PathVariable String clientMoniker, @RequestBody JSONObject rpaySubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.updateClientRpayPaymentConfig(manager, clientMoniker, rpaySubMerchantInfo);
}
@ManagerMapping(value = "/{clientMoniker}/ali_sub_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void updateAliSubMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject aliSubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.updateAliSubMerchantId(manager, clientMoniker, aliSubMerchantInfo);
@ -518,6 +523,11 @@ public class PartnerManageController {
return clientManager.listSubMerchantIdApplys(manager, clientMoniker);
}
@ManagerMapping(value = "/{clientMoniker}/list_rpay_sub_applices", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public List<JSONObject> listRpaySubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listRpaySubMerchantIdApplys(manager, clientMoniker);
}
@ManagerMapping(value = "/{clientMoniker}/sub_apply", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public String subMerchantApplication(@PathVariable String clientMoniker, @RequestBody SubMerchantIdApply subMerchantIdApply, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.subMerchantApplication(clientMoniker, subMerchantIdApply, manager);

@ -3084,6 +3084,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_sub_applices', {params: {}}).then(function (resp) {
$scope.subMerchantInfos = resp.data;
});
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_rpay_sub_applices', {params: {}}).then(function (resp) {
$scope.subRpayMerchantInfos = resp.data;
});
};
$scope.useSubMerchantId = function (sub_merchant_id) {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: sub_merchant_id}).then(function (resp) {
@ -3097,6 +3100,18 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
}
$scope.useRpaySubMerchantId = function (sub_merchant_id) {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/rpay_payment_config', {rpay_enterprise_id: sub_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Modify Rpay+ Sub Merchant ID successfully',
type: 'success'
});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
}
$scope.applyWxSubMerchantId = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/apply_wx_sub_merchant_id.html',
@ -3117,7 +3132,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/registRpaySubMerchantId').then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Modify Wechat Sub Merchant ID successfully',
content: 'Modify Rpay+ Sub Merchant ID successfully',
type: 'success'
});
$state.reload();

@ -48,6 +48,14 @@
</p>
</div>
</div>
<div class="form-group" ng-if="'10'|withRole">
<label class="col-sm-3 control-label">Rpay+ Institution Merchant Id</label>
<div class="col-sm-9">
<p class="form-control-static">
{{paymentInfo.rpay_enterprise_id||'初始化'}}
</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Ali Sub Merchant Id</label>

@ -41,19 +41,6 @@
</button>
</div>
</div>
<div class="box box-warning">
<div class="box-header">
<h3 class="box-title pull-left" ng-if="partner.sub_merchant_id">
Rpay+ Sub Merchant Id : {{partner.sub_merchant_id}}
<i class="fa fa-clock-o text-danger" title="Using temp Sub Merchant ID" ng-if="partner.temp_sub_merchant"></i>
</h3>
<button role="button" class="btn btn-info pull-right" title="Apply Sub Merchant Id"
ng-click="applyRpaySubMerchantId()">
<i class="fa fa-plus"></i>
Apply Sub Merchant Id
</button>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">List of Sub Merchant Id</h3>
@ -101,4 +88,65 @@
</div>
</div>
</div>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<h3 class="box-title pull-left" ng-if="partner.rpay_enterprise_id">
Rpay+ Sub Merchant Id : {{partner.rpay_enterprise_id}}
<i class="fa fa-clock-o text-danger" title="Using temp Sub Merchant ID" ng-if="partner.temp_sub_merchant"></i>
</h3>
<button role="button" class="btn btn-info pull-right" title="Apply Sub Merchant Id"
ng-click="applyRpaySubMerchantId()">
<i class="fa fa-plus"></i>
Apply Sub Merchant Id
</button>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">List of Sub Merchant Id</h3>
</div>
<div class="box-body col-sm-6" ng-repeat="id_apply in subRpayMerchantInfos">
<ul class="list-group ui_desk">
<li class="list-group-item list-group-item-success">
<b>Sub Merchant Id</b>
<b style="float: right"><span
ng-if="partner.rpay_enterprise_id == id_apply.sub_merchant_id"><small
class="text-red">(当前使用)</small></span>{{id_apply.sub_merchant_id}}</b>
</li>
<li class="list-group-item list-group-item-success">
Apply Time
<span style="float: right" ng-bind="id_apply.create_time"></span>
</li>
<li class="list-group-item list-group-item-success">
Company Short Name
<span style="float:right;">{{id_apply.merchant_shortname | cut:true:20:' ...'}}</span>
</li>
<li class="list-group-item list-group-item-success">
Business Category
<span style="float: right">{{id_apply.business_category | partner_royalpay_industry}}</span>
</li>
<li class="list-group-item list-group-item-success">
Operator
<span style="float: right" ng-bind="id_apply.operator"></span>
</li>
</ul>
<div class="box_desk">
<div class="content_button">
<button role="button" class="btn btn-info" title="use"
ng-click="useRpaySubMerchantId(id_apply.sub_merchant_id)">
USE
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Loading…
Cancel
Save