commit
2e9093c1be
@ -0,0 +1,21 @@
|
||||
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 org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
|
||||
|
||||
@AutoMapper(tablename = "merchant_sign_info", pkName = "client_moniker", keyGenerator = Jdbc3KeyGenerator.class)
|
||||
public interface MerchantSignInfoMapper {
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findClientSign(@Param("client_moniker") String clientMoniker);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject signInfo);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void insert(JSONObject signInfo);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package au.com.royalpay.payment.manage.merchants.entity;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper;
|
||||
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
|
||||
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
||||
import au.com.royalpay.payment.tools.utils.id.IdUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2018-04-12 16:19
|
||||
*/
|
||||
public abstract class ClientGatewaySignModify {
|
||||
|
||||
private JSONObject account;
|
||||
|
||||
private String clientMoniker;
|
||||
|
||||
public ClientGatewaySignModify(JSONObject account, String clientMoniker) {
|
||||
this.account = account;
|
||||
this.clientMoniker = clientMoniker;
|
||||
}
|
||||
|
||||
protected abstract String business();
|
||||
|
||||
protected abstract JSONObject getModifyResult();
|
||||
|
||||
@Transactional
|
||||
public int doModify(MerchantInfoProvider merchantInfoProvider, MerchantSignInfoMapper merchantSignInfoMapper, MongoTemplate mongoTemplate) {
|
||||
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
|
||||
JSONObject clientGatewaySign = merchantSignInfoMapper.findClientSign(clientMoniker);
|
||||
JSONObject modifyResult = getModifyResult();
|
||||
try {
|
||||
saveModifyHistory(clientGatewaySign, modifyResult, mongoTemplate);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
int clientId = client.getIntValue("client_id");
|
||||
modifyResult.put("client_moniker", clientMoniker);
|
||||
modifyResult.put("last_update_by", account.getString("account_id"));
|
||||
modifyResult.put("last_update_date", new Date());
|
||||
merchantSignInfoMapper.update(modifyResult);
|
||||
return clientId;
|
||||
}
|
||||
|
||||
private void saveModifyHistory(JSONObject clientGatewaySign, JSONObject modifyResult, MongoTemplate mongoTemplate) {
|
||||
if (account == null) {
|
||||
return;
|
||||
}
|
||||
ClientConfigLog clientConfigLog = new ClientConfigLog();
|
||||
clientConfigLog.setId(IdUtil.getId());
|
||||
clientConfigLog.setBusiness(business());
|
||||
clientConfigLog.setClientId(clientGatewaySign.getIntValue("client_id"));
|
||||
|
||||
boolean isPartner = true;
|
||||
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
|
||||
isPartner = true;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
|
||||
isPartner = false;
|
||||
}
|
||||
clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager");
|
||||
clientConfigLog.setCreateTime(new Date());
|
||||
clientConfigLog.setNewData(modifyResult.toJSONString());
|
||||
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
|
||||
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, clientGatewaySign::get));
|
||||
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
|
||||
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name"));
|
||||
mongoTemplate.save(clientConfigLog);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package au.com.royalpay.payment.manage.merchants.entity.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2018-04-12 16:43
|
||||
*/
|
||||
public class GatewayInfoModify extends ClientGatewaySignModify {
|
||||
private String key;
|
||||
private String value;
|
||||
private String changeMess;
|
||||
|
||||
|
||||
public GatewayInfoModify(JSONObject account, String clientMoniker, String key, String value, String changeMess) {
|
||||
super(account, clientMoniker);
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.changeMess = changeMess;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String business() {
|
||||
return changeMess;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject getModifyResult() {
|
||||
JSONObject modify = new JSONObject();
|
||||
modify.put(key, value);
|
||||
return modify;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package au.com.royalpay.payment.manage.merchants.entity.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2018-04-12 16:43
|
||||
*/
|
||||
public class SwitchGatewaySignPermissionModify extends ClientGatewaySignModify {
|
||||
private String key;
|
||||
private boolean value;
|
||||
|
||||
public SwitchGatewaySignPermissionModify(JSONObject account, String clientMoniker, String key, boolean value) {
|
||||
super(account, clientMoniker);
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String business() {
|
||||
|
||||
return (value?"开启 ":"关闭 ")+key;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject getModifyResult() {
|
||||
JSONObject modify = new JSONObject();
|
||||
modify.put(key, value);
|
||||
return modify;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
[
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [],
|
||||
"label": "谷歌|Google",
|
||||
"mccCode": "10001"
|
||||
},
|
||||
{
|
||||
"children": [],
|
||||
"label": "领英|LinkedIn",
|
||||
"mccCode": "10002"
|
||||
},
|
||||
{
|
||||
"children": [],
|
||||
"label": "微信|Wechat",
|
||||
"mccCode": "10003"
|
||||
},
|
||||
{
|
||||
"children": [],
|
||||
"label": "传单手册|Flyer Manual",
|
||||
"mccCode": "10004"
|
||||
},
|
||||
{
|
||||
"children": [],
|
||||
"label": "其他媒体|Other Media",
|
||||
"mccCode": "10005"
|
||||
}
|
||||
],
|
||||
"label": "媒体宣传|Media",
|
||||
"mccCode": "1"
|
||||
},
|
||||
{
|
||||
"label": "线下使用体验|Offline Experience",
|
||||
"mccCode": "2"
|
||||
},
|
||||
{
|
||||
"label": "朋友介绍|Friend Introduction",
|
||||
"mccCode": "3"
|
||||
},
|
||||
{
|
||||
"label": "商户推荐|Merchant Recommendation",
|
||||
"mccCode": "4"
|
||||
},
|
||||
{
|
||||
"label": "销售推荐|Sales Recommendation",
|
||||
"mccCode": "5"
|
||||
}
|
||||
]
|
Before Width: | Height: | Size: 704 KiB After Width: | Height: | Size: 796 KiB |
Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 301 KiB |
Before Width: | Height: | Size: 767 KiB After Width: | Height: | Size: 1.4 MiB |
@ -0,0 +1,33 @@
|
||||
<style>
|
||||
.modal-class {
|
||||
}
|
||||
.modal-lg {
|
||||
width: 40%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="modal-header">
|
||||
<h4>RoyalPay Public Key</h4>
|
||||
</div>
|
||||
<div class="modal-body" style="height: 400px;">
|
||||
<form novalidate name="resetForm">
|
||||
<div class="form-group">
|
||||
<label class="control-label" style="font-size: 20px;">RoyalPay Public key
|
||||
</label>
|
||||
<i class="fa fa-clipboard margin-r-5" style="cursor: pointer;float: right;" ng-click="copyPublicKey()"></i>
|
||||
<textarea style="height: 250px;margin-top: 15px"
|
||||
id="c-cpKey" class="form-control" ng-model="gateway_sign.platform_public_key" name="public-key" readonly></textarea>
|
||||
</div>
|
||||
<button class="btn btn-warning" type="button" ng-click="refreshPublicKey()" ng-if="'111'|withRole">
|
||||
<a role="button"
|
||||
title="refresh">
|
||||
<i class="fa fa-refresh"></i>
|
||||
</a>
|
||||
Refresh RoyalPay Public Key</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
|
||||
</div>
|
@ -0,0 +1,30 @@
|
||||
<style>
|
||||
.modal-class {
|
||||
}
|
||||
.modal-lg {
|
||||
width: 40%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="modal-header">
|
||||
<h4>Upload Partner Public Key</h4>
|
||||
</div>
|
||||
<div class="modal-body" style="height: 400px;">
|
||||
<form novalidate name="resetForm">
|
||||
<div class="form-group">
|
||||
<label class="control-label" style="font-size: 20px;" for="public-key-input">Upload Public key
|
||||
*</label>
|
||||
<textarea style="height: 250px;margin-top: 15px"
|
||||
id="public-key-input" class="form-control" ng-model="gateway_sign.mch_public_key" name="public-key" required></textarea>
|
||||
<p class="text-info">
|
||||
Preserve the middle part and make sure it ends up all on one line
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button" ng-click="uploadPublicKey(gateway_sign.mch_public_key)">Submit</button>
|
||||
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
|
||||
</div>
|
Loading…
Reference in new issue