royalpay快捷网银通道-商户渠道切换

master
yangkai 6 years ago
parent 4264a2bb75
commit 2eb65aa920

@ -21,4 +21,7 @@ public interface SysChannelConfigMapper {
@Param(value = "last_update_by")String lastUpdateBy, @Param(value = "is_valid") boolean is_valid);
JSONObject findOne(@Param(value = "type") int type);
@AutoSql(type = SqlType.SELECT)
JSONObject selectByChannelId (@Param(value = "channel_id") String channel_id);
}

@ -380,4 +380,6 @@ public interface ClientManager {
String cbBankPayLink(String clientMoniker);
void switchPaymentConfigPC(String clientMoniker, HttpServletResponse response) throws IOException;
void partnerCBChannelConfig(String clientMoniker, String channelKey, String channel_id);
}

@ -4314,6 +4314,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (paymentConfig == null) {
throw new BadRequestException("服务商未开启快捷支付");
}
if (client.getString("cb_channel_id") != null) {
JSONObject channelConfig = sysChannelConfigMapper.selectByChannelId(client.getString("cb_channel_id"));
if (channelConfig != null) {
paymentConfig = channelConfig;
}
}
response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(paymentConfig.getString("path")), clientMoniker));
}
@ -4346,6 +4352,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (paymentConfig == null) {
throw new BadRequestException("服务商未开启快捷支付");
}
if (client.getString("cb_channel_id") != null) {
JSONObject channelConfig = sysChannelConfigMapper.selectByChannelId(client.getString("cb_channel_id"));
if (channelConfig != null) {
paymentConfig = channelConfig;
}
}
return String.format(PlatformEnvironment.getEnv().concatUrl(paymentConfig.getString("path")), clientMoniker);
}
@ -4359,11 +4371,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (paymentConfig == null) {
throw new BadRequestException("服务商未开启快捷支付");
}
if (client.getString("cb_channel_id") != null) {
JSONObject channelConfig = sysChannelConfigMapper.selectByChannelId(client.getString("cb_channel_id"));
if (channelConfig != null) {
paymentConfig = channelConfig;
}
}
String path = paymentConfig.getString("path");
path = path.replaceAll("app","pc");
response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(path), clientMoniker));
}
@Override
public void partnerCBChannelConfig(String clientMoniker, String channelKey, String channel_id) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
throw new BadRequestException("partner code is not exists!");
}
if (StringUtils.isNotEmpty(channel_id)) {
JSONObject cbBankConfig = sysChannelConfigMapper.selectByChannelId(channel_id);
if (cbBankConfig == null) {
throw new BadRequestException("不存在该支付渠道");
}
}
JSONObject updateClient = new JSONObject();
updateClient.put("client_id", client.getIntValue("client_id"));
updateClient.put(channelKey, channel_id);
clientMapper.update(updateClient);
}
private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) {
TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null);
notice.put("first", "您好您的合同费率已到期根据合同协议系统已自动为您延期1年。", "#ff0000");

@ -646,4 +646,16 @@ public class PartnerManageController {
public void switchPaymentWayPC(@PathVariable String clientMoniker, HttpServletResponse response) throws IOException {
clientManager.switchPaymentConfigPC(clientMoniker, response);
}
/**
*
* @param clientMoniker
* @param channelKey
* @throws IOException
*/
@ManagerMapping(value = "/{clientMoniker}/cb_bankpay/{channelKey}/channel_id", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void switchPartnerCBChannelConfig(@PathVariable String clientMoniker, @PathVariable String channelKey, @RequestBody JSONObject channel) {
clientManager.partnerCBChannelConfig(clientMoniker, channelKey, channel.getString("channel_id"));
}
}

@ -1649,7 +1649,37 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
})
};
$scope.cb_bankpay = [];
$scope.cbChannelConfig = function () {
$http.get('/sysconfig/payment/config').then(function (resp) {
resp.data.forEach(function (channel) {
if (channel.type === 1) {
$scope.cb_bankpay.push(channel);
}
})
})
};
$scope.cbChannelConfig();
$scope.updateCBBankPayConfig = function (key, channel) {
var content = "";
if (channel == null) {
content = "你确定要将支付通道跟随系统"
} else {
content = '你确定要将支付通道更改为:' + channel
}
commonDialog.confirm({
title: 'Confirm',
content: content
}).then(function () {
$http.put('/sys/partners/'+ $scope.partner.client_moniker + '/cb_bankpay/'+ key +'/channel_id', {channel_id: channel}).then(function (resp) {
commonDialog.alert({type: 'success', title: 'Success', content: '修改成功'});
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
$scope.loadPartnerPaymentInfo();
});
})
};
$scope.toggleGatewayEmailNotice = function (channel) {
if (!$scope.paymentInfo) {
return;

@ -414,6 +414,17 @@
<input ng-if="paymentInfo.enable_cb_bankpay_link" style="opacity: 0" id="cpcbbankpay" value={{paymentInfo.cb_bankpay_url}} readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">CB Bank Pay Channel</label>
<div class="col-sm-3">
<select class="form-control" name="industry" ng-change="updateCBBankPayConfig('cb_channel_id',partner.cb_channel_id)"
ng-model="partner.cb_channel_id"
id="cbbankpay-input" required
ng-options="channel.channel_id as channel.channel_name for channel in cb_bankpay">
<option value="">跟随系统</option>
</select>
</div>
</div>
<div class="form-group" ng-if="paymentInfo.enable_cb_bankpay && paymentInfo.enable_cb_bankpay_link">
<label class="col-sm-2 control-label">CB Bank Pay QR Code</label>
<img ng-src="{{paymentInfo.cbBankPayQrcodeUrl}}" class="img-responsive" />

Loading…
Cancel
Save