parent
c6e00a74db
commit
8e12b4b7e5
@ -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_id", keyGenerator = Jdbc3KeyGenerator.class)
|
||||
public interface MerchantSignInfoMapper {
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findClientSign(@Param("client_id") int clientId);
|
||||
|
||||
@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(client.getIntValue("client_id"));
|
||||
JSONObject modifyResult = getModifyResult();
|
||||
try {
|
||||
saveModifyHistory(clientGatewaySign, modifyResult, mongoTemplate);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
int clientId = client.getIntValue("client_id");
|
||||
modifyResult.put("client_id", clientId);
|
||||
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,33 @@
|
||||
package au.com.royalpay.payment.manage.merchants.entity.impls;
|
||||
|
||||
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,31 @@
|
||||
package au.com.royalpay.payment.manage.merchants.entity.impls;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 704 KiB After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 767 KiB After Width: | Height: | Size: 2.1 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